Documentation
¶
Index ¶
- Constants
- func Audit(format string, args ...any)
- func BlackholeLogf(format string, args ...any)
- func Close()
- func Critical(format string, args ...any)
- func Debug(format string, args ...any)
- func Error(format string, args ...any)
- func Evaluate(format string, args ...any)
- func Info(format string, args ...any)
- func SetGlobalLogger(l *Logger)
- func Stats(format string, args ...any)
- func Trace(format string, args ...any)
- func Transaction(format string, args ...any)
- func Verbose(format string, args ...any)
- func Warning(format string, args ...any)
- type AsyncLogWriter
- type Logger
Constants ¶
View Source
const ( LogQueueSize = 1024 ShowCallerFileLine = true )
View Source
const ( LogLevelSilent = iota LogLevelError LogLevelInfo LogLevelAudit LogLevelDebug LogLevelTrace )
Log levels for use with NewLogger.
Variables ¶
This section is empty.
Functions ¶
func BlackholeLogf ¶
Function for use in Logger for discarding logged lines.
func SetGlobalLogger ¶
func SetGlobalLogger(l *Logger)
func Transaction ¶
Types ¶
type AsyncLogWriter ¶
type AsyncLogWriter struct { sync.Mutex DirPath string Name string // contains filtered or unexported fields }
func (*AsyncLogWriter) Close ¶
func (lw *AsyncLogWriter) Close()
func (*AsyncLogWriter) Start ¶
func (lw *AsyncLogWriter) Start()
type Logger ¶
type Logger struct { sync.Mutex Warning func(format string, args ...any) Error func(format string, args ...any) Critical func(format string, args ...any) Evaluate func(format string, args ...any) Info func(format string, args ...any) Stats func(format string, args ...any) Audit func(format string, args ...any) Transaction func(format string, args ...any) Debug func(format string, args ...any) Trace func(format string, args ...any) Verbose func(format string, args ...any) // contains filtered or unexported fields }
A logger that implements async logging by default (logging without impact on real business logic). It also provides customizable logging functions. At default implementation, it is recommended to call Close() at program termination.
func NewLogger ¶
NewLogger constructs a Logger that logs at the specified log l.logLevel and above. It decorates log lines with the log l.logLevel, date, time, and prepend.
func (*Logger) DateUpdateChan ¶
func (*Logger) SetLogLevel ¶
Click to show internal directories.
Click to hide internal directories.