flogging

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLoggingLevel

func DefaultLoggingLevel() logging.Level

DefaultLoggingLevel returns the fallback value for loggers to use if parsing fails

func LoggingFileInit

func LoggingFileInit(fpath string) error

func LoggingInit

func LoggingInit(command string)

LoggingInit is a 'hook' called at the beginning of command processing to parse logging-related options specified either on the command-line or in config files. Command-line options take precedence over config file options, and can also be passed as suitably-named environment variables. To change module logging levels at runtime call `logging.SetLevel(level, module)`. To debug this routine include logging=debug as the first term of the logging specification.

func SetLogFormat

func SetLogFormat(formatStr string) error

func SetLogOutput

func SetLogOutput(w io.Writer, prefix string, flag int)

Types

type FileLogBackend

type FileLogBackend struct {
	Logger *log.Logger

	sync.Mutex
	// contains filtered or unexported fields
}

LogBackend utilizes the standard log module.

func NewFileLogBackend

func NewFileLogBackend(filePath string, prefix string, flag int,
	flushLevel logging.Level, syncLevel logging.Level) (*FileLogBackend, error)

func (*FileLogBackend) Log

func (b *FileLogBackend) Log(level logging.Level, calldepth int, rec *logging.Record) error

Log implements the Backend interface.

type GoRoutineIDPrinter

type GoRoutineIDPrinter int
var GoRDef GoRoutineIDPrinter = 0

func (GoRoutineIDPrinter) String

func (base GoRoutineIDPrinter) String() string

type ModuleLeveled

type ModuleLeveled struct {
	logging.Backend
	// contains filtered or unexported fields
}
var (
	DefaultBackend *ModuleLeveled
)

func DuplicateLevelBackend

func DuplicateLevelBackend(backend logging.Backend) *ModuleLeveled

duplicate from the default one and replace with another backend

func (*ModuleLeveled) GetLevel

func (l *ModuleLeveled) GetLevel(module string) logging.Level

GetLevel returns the log level for the given module.

func (*ModuleLeveled) IsEnabledFor

func (l *ModuleLeveled) IsEnabledFor(level logging.Level, module string) bool

IsEnabledFor will return true if logging is enabled for the given module.

func (*ModuleLeveled) Log

func (l *ModuleLeveled) Log(level logging.Level, calldepth int, rec *logging.Record) error

func (*ModuleLeveled) SetLevel

func (l *ModuleLeveled) SetLevel(level logging.Level, module string)

SetLevel sets the log level for the given module.

Jump to

Keyboard shortcuts

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