Documentation ¶
Overview ¶
package loggers contains some basic logging setup.
Index ¶
- Variables
- func InitGlobalLogger(level logg.Level, panicOnWarnings bool)
- func LevelLoggerToWriter(l logg.LevelLogger) io.Writer
- func TimeTrackf(l logg.LevelLogger, start time.Time, fields logg.Fields, format string, ...)
- func TimeTrackfn(fn func() (logg.LevelLogger, error)) error
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // FieldNameCmd is the name of the field that holds the command name. FieldNameCmd = reservedFieldNamePrefix + "_cmd" // Used to suppress statements. FieldNameStatementID = reservedFieldNamePrefix + "__h_field_statement_id" )
View Source
var PanicOnWarningHook = func(e *logg.Entry) error { if e.Level != logg.LevelWarn { return nil } panic(e.Message) }
PanicOnWarningHook panics on warnings.
Functions ¶
func InitGlobalLogger ¶ added in v0.123.10
func LevelLoggerToWriter ¶ added in v0.123.10
func LevelLoggerToWriter(l logg.LevelLogger) io.Writer
func TimeTrackf ¶ added in v0.123.10
func TimeTrackfn ¶ added in v0.123.10
func TimeTrackfn(fn func() (logg.LevelLogger, error)) error
Types ¶
type Logger ¶ added in v0.123.10
type Logger interface { Debug() logg.LevelLogger Debugf(format string, v ...any) Debugln(v ...any) Error() logg.LevelLogger Errorf(format string, v ...any) Erroridf(id, format string, v ...any) Errorln(v ...any) Errors() string Info() logg.LevelLogger InfoCommand(command string) logg.LevelLogger Infof(format string, v ...any) Infoln(v ...any) Level() logg.Level LoggCount(logg.Level) int Logger() logg.Logger Out() io.Writer Printf(format string, v ...any) Println(v ...any) PrintTimerIfDelayed(start time.Time, name string) Reset() Warn() logg.LevelLogger WarnCommand(command string) logg.LevelLogger Warnf(format string, v ...any) Warnidf(id, format string, v ...any) Warnln(v ...any) Deprecatef(fail bool, format string, v ...any) Trace(s logg.StringFunc) }
func NewDefault ¶ added in v0.123.10
func NewDefault() Logger
NewDefault creates a new logger with the default options.
Click to show internal directories.
Click to hide internal directories.