logger

package
v0.0.0-...-8fd811e Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultActiveDynamicLogs = true

Functions

This section is empty.

Types

type DynamicLogger

type DynamicLogger struct {
	*Logger
	*LogController
}

func ForkToDynamicLogger

func ForkToDynamicLogger(l *Logger, prefix string, enabled bool, defaultActive bool) (dl *DynamicLogger)

func NewDynamicLogger

func NewDynamicLogger(prefix string, output LogOutput, level LogLevel, enabled bool, defaultActive bool) (dl *DynamicLogger)

func (*DynamicLogger) Debugf

func (d *DynamicLogger) Debugf(f string, args ...interface{})

func (*DynamicLogger) Errorf

func (d *DynamicLogger) Errorf(f string, args ...interface{})

func (*DynamicLogger) Fork

func (d *DynamicLogger) Fork(prefix string, args ...interface{}) (dl *DynamicLogger)

func (*DynamicLogger) GetLogger

func (d *DynamicLogger) GetLogger() (l *Logger)

func (*DynamicLogger) Infof

func (d *DynamicLogger) Infof(f string, args ...interface{})

func (*DynamicLogger) Logf

func (d *DynamicLogger) Logf(severity LogLevel, f string, args ...interface{})

func (*DynamicLogger) NDebugf

func (d *DynamicLogger) NDebugf(name string, f string, args ...interface{})

func (*DynamicLogger) NErrorf

func (d *DynamicLogger) NErrorf(name string, f string, args ...interface{})

func (*DynamicLogger) NInfof

func (d *DynamicLogger) NInfof(name string, f string, args ...interface{})

func (*DynamicLogger) NLogf

func (d *DynamicLogger) NLogf(name string, severity LogLevel, f string, args ...interface{})

type ILogger

type ILogger interface {
	Errorf(f string, args ...interface{})
	Infof(f string, args ...interface{})
	Debugf(f string, args ...interface{})
	Logf(severity LogLevel, f string, args ...interface{})
	Fork(prefix string, args ...interface{})
	Prefix() string
}

type LogControl

type LogControl map[string]bool

type LogController

type LogController struct {
	// contains filtered or unexported fields
}

func (*LogController) Clone

func (lc *LogController) Clone() (clonedLC *LogController)

func (*LogController) DefaultActive

func (lc *LogController) DefaultActive() (defaultActive bool)

func (*LogController) IsActive

func (lc *LogController) IsActive(name string) (active bool)

func (*LogController) SetControl

func (lc *LogController) SetControl(name string, active bool)

type LogLevel

type LogLevel int
const (
	LogLevelError LogLevel = 0
	LogLevelInfo  LogLevel = 1
	LogLevelDebug LogLevel = 2
)

func ParseLogLevel

func ParseLogLevel(str string) (LogLevel, error)

func (LogLevel) String

func (l LogLevel) String() string

type LogOutput

type LogOutput struct {
	File *os.File
	// contains filtered or unexported fields
}

func NewLogOutput

func NewLogOutput(filePath string) LogOutput

func (*LogOutput) Shutdown

func (o *LogOutput) Shutdown()

func (*LogOutput) Start

func (o *LogOutput) Start() error

type Logger

type Logger struct {
	Level LogLevel
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(prefix string, output LogOutput, level LogLevel) *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(f string, args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(f string, args ...interface{})

func (*Logger) Fork

func (l *Logger) Fork(prefix string, args ...interface{}) *Logger

func (*Logger) Infof

func (l *Logger) Infof(f string, args ...interface{})

func (*Logger) Logf

func (l *Logger) Logf(severity LogLevel, f string, args ...interface{})

func (*Logger) Prefix

func (l *Logger) Prefix() string

type MemLogger

type MemLogger struct {
	// contains filtered or unexported fields
}

func NewMemLogger

func NewMemLogger() MemLogger

NewMemLogger creates a logger that stores messages in memory used for early logging while the "real" file-based logger is not loaded yet.

func (*MemLogger) Debug

func (ml *MemLogger) Debug(msg string)

func (*MemLogger) Debugf

func (ml *MemLogger) Debugf(msg string, args ...interface{})

func (*MemLogger) Error

func (ml *MemLogger) Error(msg string)

func (*MemLogger) Errorf

func (ml *MemLogger) Errorf(msg string, args ...interface{})

func (*MemLogger) Flush

func (ml *MemLogger) Flush(l *Logger)

func (*MemLogger) Info

func (ml *MemLogger) Info(msg string)

func (*MemLogger) Infof

func (ml *MemLogger) Infof(msg string, args ...interface{})

Jump to

Keyboard shortcuts

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