logging

package
v7.6.77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: GPL-3.0 Imports: 17 Imported by: 3

Documentation

Overview

Package logging configures the golog subsystem for use with Lantern Import this to make sure golog is initialized before you log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close stops logging.

func EnableFileLogging

func EnableFileLogging(appName, logdir string)

EnableFileLogging configures golog to write to rotated files under the logdir for the given appName, in addition to standard outputs.

func EnableFileLoggingWith

func EnableFileLoggingWith(werr io.WriteCloser, wout io.WriteCloser, appName, logdir string, debugBufferDepth, errorBufferDepth int) error

EnableFileLoggingWith is similar to EnableFileLogging but allows overriding standard outputs and setting buffer depths for error and debug log channels.

func NonStopWriteCloser

func NonStopWriteCloser(writers ...io.WriteCloser) io.WriteCloser

NonStopWriteCloser creates a WriteCloser that duplicates its writes to all the provided WriteClosers, even if errors encountered while writing. It doesn't close the provided WriteClosers.

func RegisterUserAgent

func RegisterUserAgent(agent string)

RegisterUserAgent tries to find the User-Agent in the HTTP request and keep track of the applications using Lantern during this session

func RotatedLogsUnder

func RotatedLogsUnder(appName, logdir string) (io.WriteCloser, error)

RotatedLogsUnder creates rotated file logger under logdir using the given appName

func Timestamped

func Timestamped(w io.Writer)

Timestamped writes the current time and the duration since process start to the writer, used by golog.SetPrepender().

func ZipLogFiles

func ZipLogFiles(w io.Writer, underFolder string, maxBytes int64, maxTextBytes int64) (string, error)

ZipLogFiles zips the Lantern log files to the writer. All files will be placed under the folder in the archieve. It will stop and return if the newly added file would make the extracted files exceed maxBytes in total.

It also returns up to maxTextBytes of plain text from the end of the most recent log file.

func ZipLogFilesFrom

func ZipLogFilesFrom(w io.Writer, maxBytes int64, maxTextBytes int64, dirs map[string]string) (string, error)

ZipLogFilesFrom zips the log files from the given dirs to the writer. It will stop and return if the newly added file would make the extracted files exceed maxBytes in total.

It also returns up to maxTextBytes of plain text from the end of the most recent log file.

Types

type FlashlightLogger

type FlashlightLogger struct{ golog.Logger }

FlashlightLogger is a logger that uses golog.Logger to log messages. It implements a logging interface that packages like quicproxy use. See here for more info: - https://github.com/getlantern/quicproxy/blob/d393da079842dda222d5c0ddbc1ba33e55c46e8b/README.md#L40

func (FlashlightLogger) Errorf

func (l FlashlightLogger) Errorf(format string, a ...any)

func (FlashlightLogger) Infof

func (l FlashlightLogger) Infof(format string, a ...any)

func (FlashlightLogger) Printf

func (l FlashlightLogger) Printf(format string, a ...any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL