Documentation
¶
Overview ¶
Package log2 solves these issues: - log level filtering, e.g. show debug messages in internal tests only - safe concurrent change of log level
Primary goal was to run parallel tests and log into t.Logf() safely, and TBH, would have been enough to pass around explicit stdlib *log.Logger. Well, log levels is just a cherry on top.
Index ¶
- Constants
- type ErrorFunc
- type FmtFunc
- type FmtFuncWriter
- type Level
- type Log
- func (lg *Log) Clone(level Level) *Log
- func (lg *Log) Debug(args ...interface{})
- func (lg *Log) Debugf(format string, args ...interface{})
- func (lg *Log) Enabled(level Level) bool
- func (lg *Log) Err(args ...interface{})
- func (lg *Log) Errf(format string, args ...interface{})
- func (lg *Log) Error(args ...interface{})
- func (lg *Log) Errorf(format string, args ...interface{})
- func (lg *Log) Fatal(args ...interface{})
- func (lg *Log) Fatalf(format string, args ...interface{})
- func (lg *Log) Info(args ...interface{})
- func (lg *Log) Infof(format string, args ...interface{})
- func (lg *Log) Log(level Level, s string)
- func (l *Log) LogToConsole()
- func (l *Log) LogToSyslog()
- func (lg *Log) Logf(level Level, format string, args ...interface{})
- func (lg *Log) Notice(args ...interface{})
- func (lg *Log) NoticeF(format string, args ...interface{})
- func (lg *Log) Printf(format string, args ...interface{})
- func (lg *Log) Println(args ...interface{})
- func (lg *Log) SetErrorFunc(f ErrorFunc)
- func (lg *Log) SetFlags(f int)
- func (lg *Log) SetLevel(l Level)
- func (lg *Log) SetOutput(w io.Writer)
- func (lg *Log) SetPrefix(prefix string)
- func (lg *Log) Stdlib() *log.Logger
- func (lg *Log) Warning(args ...interface{})
- func (lg *Log) WarningF(format string, args ...interface{})
Constants ¶
View Source
const ( // type specified here helped against accidentally passing flags as level Lmicroseconds int = log.Lmicroseconds Lshortfile int = log.Lshortfile LStdFlags int = log.Ltime | Lshortfile LInteractiveFlags int = log.Ltime | Lshortfile | Lmicroseconds LServiceFlags int = Lshortfile LTestFlags int = Lshortfile | Lmicroseconds )
View Source
const ( LOG_EMERG = iota LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG )
View Source
const ContextKey = "run/log"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FmtFuncWriter ¶
type FmtFuncWriter struct{ FmtFunc }
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func ContextValueLogger ¶
func (*Log) LogToConsole ¶ added in v0.220725.0
func (l *Log) LogToConsole()
func (*Log) LogToSyslog ¶ added in v0.220725.0
func (l *Log) LogToSyslog()
func (*Log) SetErrorFunc ¶
Click to show internal directories.
Click to hide internal directories.