Documentation
¶
Index ¶
- Variables
- func Close() error
- func Debug(parts ...interface{})
- func Debugf(message string, args ...interface{})
- func Debugfln(message string, args ...interface{})
- func Debugln(parts ...interface{})
- func Error(parts ...interface{})
- func Errorf(message string, args ...interface{})
- func Errorfln(message string, args ...interface{})
- func Errorln(parts ...interface{})
- func Fatal(parts ...interface{})
- func Fatalf(message string, args ...interface{})
- func Fatalfln(message string, args ...interface{})
- func Fatalln(parts ...interface{})
- func Info(parts ...interface{})
- func Infof(message string, args ...interface{})
- func Infofln(message string, args ...interface{})
- func Infoln(parts ...interface{})
- func Log(level Level, parts ...interface{})
- func Logf(level Level, message string, args ...interface{})
- func Logfln(level Level, message string, args ...interface{})
- func Logln(level Level, parts ...interface{})
- func OpenFile() error
- func Raw(level Level, module, message string)
- func Rawm(level Level, metadata map[string]interface{}, module, message string)
- func SetWriter(w *os.File)
- func Warn(parts ...interface{})
- func Warnf(message string, args ...interface{})
- func Warnfln(message string, args ...interface{})
- func Warnln(parts ...interface{})
- type BasicLogger
- func (log *BasicLogger) Close() error
- func (log *BasicLogger) Debug(parts ...interface{})
- func (log *BasicLogger) Debugf(message string, args ...interface{})
- func (log *BasicLogger) Debugfln(message string, args ...interface{})
- func (log *BasicLogger) Debugln(parts ...interface{})
- func (log *BasicLogger) EnableJSONStdout()
- func (log *BasicLogger) Error(parts ...interface{})
- func (log *BasicLogger) Errorf(message string, args ...interface{})
- func (log *BasicLogger) Errorfln(message string, args ...interface{})
- func (log *BasicLogger) Errorln(parts ...interface{})
- func (log *BasicLogger) Fatal(parts ...interface{})
- func (log *BasicLogger) Fatalf(message string, args ...interface{})
- func (log *BasicLogger) Fatalfln(message string, args ...interface{})
- func (log *BasicLogger) Fatalln(parts ...interface{})
- func (log *BasicLogger) GetParent() Logger
- func (log *BasicLogger) Info(parts ...interface{})
- func (log *BasicLogger) Infof(message string, args ...interface{})
- func (log *BasicLogger) Infofln(message string, args ...interface{})
- func (log *BasicLogger) Infoln(parts ...interface{})
- func (log *BasicLogger) Log(level Level, parts ...interface{})
- func (log *BasicLogger) Logf(level Level, message string, args ...interface{})
- func (log *BasicLogger) Logfln(level Level, message string, args ...interface{})
- func (log *BasicLogger) Logln(level Level, parts ...interface{})
- func (log *BasicLogger) OpenFile() error
- func (log *BasicLogger) Raw(level Level, extraMetadata map[string]interface{}, module, origMessage string)
- func (log *BasicLogger) SetWriter(w *os.File)
- func (log *BasicLogger) Sub(module string) Logger
- func (log *BasicLogger) Subm(module string, metadata map[string]interface{}) Logger
- func (log *BasicLogger) Warn(parts ...interface{})
- func (log *BasicLogger) Warnf(message string, args ...interface{})
- func (log *BasicLogger) Warnfln(message string, args ...interface{})
- func (log *BasicLogger) Warnln(parts ...interface{})
- func (log *BasicLogger) WithDefaultLevel(lvl Level) Logger
- func (log *BasicLogger) Writer(level Level) io.WriteCloser
- type Level
- type LogWriter
- type Logger
- type LoggerFileFormat
- type Sublogger
- func (log *Sublogger) Debug(parts ...interface{})
- func (log *Sublogger) Debugf(message string, args ...interface{})
- func (log *Sublogger) Debugfln(message string, args ...interface{})
- func (log *Sublogger) Debugln(parts ...interface{})
- func (log *Sublogger) Error(parts ...interface{})
- func (log *Sublogger) Errorf(message string, args ...interface{})
- func (log *Sublogger) Errorfln(message string, args ...interface{})
- func (log *Sublogger) Errorln(parts ...interface{})
- func (log *Sublogger) Fatal(parts ...interface{})
- func (log *Sublogger) Fatalf(message string, args ...interface{})
- func (log *Sublogger) Fatalfln(message string, args ...interface{})
- func (log *Sublogger) Fatalln(parts ...interface{})
- func (log *Sublogger) GetParent() Logger
- func (log *Sublogger) Info(parts ...interface{})
- func (log *Sublogger) Infof(message string, args ...interface{})
- func (log *Sublogger) Infofln(message string, args ...interface{})
- func (log *Sublogger) Infoln(parts ...interface{})
- func (log *Sublogger) Log(level Level, parts ...interface{})
- func (log *Sublogger) Logf(level Level, message string, args ...interface{})
- func (log *Sublogger) Logfln(level Level, message string, args ...interface{})
- func (log *Sublogger) Logln(level Level, parts ...interface{})
- func (log *Sublogger) SetDefaultLevel(lvl Level)
- func (log *Sublogger) SetModule(mod string)
- func (log *Sublogger) SetParent(parent *BasicLogger)
- func (log *Sublogger) Sub(module string) Logger
- func (log *Sublogger) Subm(module string, metadata map[string]interface{}) Logger
- func (log *Sublogger) Warn(parts ...interface{})
- func (log *Sublogger) Warnf(message string, args ...interface{})
- func (log *Sublogger) Warnfln(message string, args ...interface{})
- func (log *Sublogger) Warnln(parts ...interface{})
- func (log *Sublogger) WithDefaultLevel(lvl Level) Logger
- func (log *Sublogger) Write(p []byte) (n int, err error)
- func (log *Sublogger) Writer(level Level) io.WriteCloser
Constants ¶
This section is empty.
Variables ¶
var ( // LevelDebug is the level for debug messages. LevelDebug = Level{Name: "DEBUG", Color: -1, Severity: 0} // LevelInfo is the level for basic log messages. LevelInfo = Level{Name: "INFO", Color: 36, Severity: 10} // LevelWarn is the level saying that something went wrong, but the program will continue operating mostly normally. LevelWarn = Level{Name: "WARN", Color: 33, Severity: 50} // LevelError is the level saying that something went wrong and the program may not operate as expected, but will still continue. LevelError = Level{Name: "ERROR", Color: 31, Severity: 100} // LevelFatal is the level saying that something went wrong and the program will not operate normally. LevelFatal = Level{Name: "FATAL", Color: 35, Severity: 9001} )
var DefaultLogger = Create().(*BasicLogger)
DefaultLogger ...
Functions ¶
func Close ¶
func Close() error
Close formats the given parts with fmt.Sprint and logs the result with the Close level
func Debug ¶
func Debug(parts ...interface{})
Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func Debugf ¶
func Debugf(message string, args ...interface{})
Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func Debugfln ¶ added in v2.1.0
func Debugfln(message string, args ...interface{})
Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
func Debugln ¶
func Debugln(parts ...interface{})
Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func Error ¶
func Error(parts ...interface{})
Error formats the given parts with fmt.Sprint and logs the result with the Error level
func Errorf ¶
func Errorf(message string, args ...interface{})
Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func Errorfln ¶ added in v2.1.0
func Errorfln(message string, args ...interface{})
Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
func Errorln ¶
func Errorln(parts ...interface{})
Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func Fatal ¶
func Fatal(parts ...interface{})
Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func Fatalf ¶
func Fatalf(message string, args ...interface{})
Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func Fatalfln ¶ added in v2.1.0
func Fatalfln(message string, args ...interface{})
Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
func Fatalln ¶
func Fatalln(parts ...interface{})
Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func Info ¶
func Info(parts ...interface{})
Info formats the given parts with fmt.Sprint and logs the result with the Info level
func Infof ¶
func Infof(message string, args ...interface{})
Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func Infofln ¶ added in v2.1.0
func Infofln(message string, args ...interface{})
Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
func Infoln ¶
func Infoln(parts ...interface{})
Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func Log ¶
func Log(level Level, parts ...interface{})
Log formats the given parts with fmt.Sprint and logs the result with the given level
func Logf ¶
Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func Logfln ¶
Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func Logln ¶
func Logln(level Level, parts ...interface{})
Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func OpenFile ¶
func OpenFile() error
OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
func Rawm ¶ added in v2.3.0
Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
func SetWriter ¶
SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
func Warn ¶
func Warn(parts ...interface{})
Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func Warnf ¶
func Warnf(message string, args ...interface{})
Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
Types ¶
type BasicLogger ¶
type BasicLogger struct { PrintLevel int FlushLineThreshold int FileTimeFormat string FileFormat LoggerFileFormat TimeFormat string FileMode os.FileMode DefaultSub Logger JSONFile bool JSONStdout bool StdoutLock sync.Mutex StderrLock sync.Mutex // contains filtered or unexported fields }
func (*BasicLogger) Close ¶
func (log *BasicLogger) Close() error
Close formats the given parts with fmt.Sprint and logs the result with the Close level
func (*BasicLogger) Debug ¶
func (log *BasicLogger) Debug(parts ...interface{})
Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func (*BasicLogger) Debugf ¶
func (log *BasicLogger) Debugf(message string, args ...interface{})
Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func (*BasicLogger) Debugfln ¶
func (log *BasicLogger) Debugfln(message string, args ...interface{})
Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
func (*BasicLogger) Debugln ¶
func (log *BasicLogger) Debugln(parts ...interface{})
Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func (*BasicLogger) EnableJSONStdout ¶ added in v2.2.3
func (log *BasicLogger) EnableJSONStdout()
func (*BasicLogger) Error ¶
func (log *BasicLogger) Error(parts ...interface{})
Error formats the given parts with fmt.Sprint and logs the result with the Error level
func (*BasicLogger) Errorf ¶
func (log *BasicLogger) Errorf(message string, args ...interface{})
Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func (*BasicLogger) Errorfln ¶
func (log *BasicLogger) Errorfln(message string, args ...interface{})
Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
func (*BasicLogger) Errorln ¶
func (log *BasicLogger) Errorln(parts ...interface{})
Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func (*BasicLogger) Fatal ¶
func (log *BasicLogger) Fatal(parts ...interface{})
Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func (*BasicLogger) Fatalf ¶
func (log *BasicLogger) Fatalf(message string, args ...interface{})
Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func (*BasicLogger) Fatalfln ¶
func (log *BasicLogger) Fatalfln(message string, args ...interface{})
Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
func (*BasicLogger) Fatalln ¶
func (log *BasicLogger) Fatalln(parts ...interface{})
Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func (*BasicLogger) GetParent ¶
func (log *BasicLogger) GetParent() Logger
func (*BasicLogger) Info ¶
func (log *BasicLogger) Info(parts ...interface{})
Info formats the given parts with fmt.Sprint and logs the result with the Info level
func (*BasicLogger) Infof ¶
func (log *BasicLogger) Infof(message string, args ...interface{})
Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func (*BasicLogger) Infofln ¶
func (log *BasicLogger) Infofln(message string, args ...interface{})
Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
func (*BasicLogger) Infoln ¶
func (log *BasicLogger) Infoln(parts ...interface{})
Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func (*BasicLogger) Log ¶
func (log *BasicLogger) Log(level Level, parts ...interface{})
Log formats the given parts with fmt.Sprint and logs the result with the given level
func (*BasicLogger) Logf ¶
func (log *BasicLogger) Logf(level Level, message string, args ...interface{})
Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func (*BasicLogger) Logfln ¶
func (log *BasicLogger) Logfln(level Level, message string, args ...interface{})
Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func (*BasicLogger) Logln ¶
func (log *BasicLogger) Logln(level Level, parts ...interface{})
Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func (*BasicLogger) OpenFile ¶
func (log *BasicLogger) OpenFile() error
OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
func (*BasicLogger) Raw ¶
func (log *BasicLogger) Raw(level Level, extraMetadata map[string]interface{}, module, origMessage string)
Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
func (*BasicLogger) SetWriter ¶
func (log *BasicLogger) SetWriter(w *os.File)
SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
func (*BasicLogger) Sub ¶
func (log *BasicLogger) Sub(module string) Logger
func (*BasicLogger) Subm ¶ added in v2.3.0
func (log *BasicLogger) Subm(module string, metadata map[string]interface{}) Logger
Subm creates a Sublogger
func (*BasicLogger) Warn ¶
func (log *BasicLogger) Warn(parts ...interface{})
Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func (*BasicLogger) Warnf ¶
func (log *BasicLogger) Warnf(message string, args ...interface{})
Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
func (*BasicLogger) Warnfln ¶
func (log *BasicLogger) Warnfln(message string, args ...interface{})
Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
func (*BasicLogger) Warnln ¶
func (log *BasicLogger) Warnln(parts ...interface{})
Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
func (*BasicLogger) WithDefaultLevel ¶ added in v2.1.1
func (log *BasicLogger) WithDefaultLevel(lvl Level) Logger
WithDefaultLevel creates a Sublogger with the same Module but different DefaultLevel
func (*BasicLogger) Writer ¶ added in v2.2.2
func (log *BasicLogger) Writer(level Level) io.WriteCloser
type Level ¶
Level is the severity level of a log entry.
type LogWriter ¶ added in v2.2.2
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter is a buffered io.Writer that writes lines to a Logger.
type Logger ¶
type Logger interface { Sub(module string) Logger Subm(module string, metadata map[string]interface{}) Logger WithDefaultLevel(level Level) Logger GetParent() Logger Writer(level Level) io.WriteCloser Log(level Level, parts ...interface{}) Logln(level Level, parts ...interface{}) Logf(level Level, message string, args ...interface{}) Logfln(level Level, message string, args ...interface{}) Debug(parts ...interface{}) Debugln(parts ...interface{}) Debugf(message string, args ...interface{}) Debugfln(message string, args ...interface{}) Info(parts ...interface{}) Infoln(parts ...interface{}) Infof(message string, args ...interface{}) Infofln(message string, args ...interface{}) Warn(parts ...interface{}) Warnln(parts ...interface{}) Warnf(message string, args ...interface{}) Warnfln(message string, args ...interface{}) Error(parts ...interface{}) Errorln(parts ...interface{}) Errorf(message string, args ...interface{}) Errorfln(message string, args ...interface{}) Fatal(parts ...interface{}) Fatalln(parts ...interface{}) Fatalf(message string, args ...interface{}) Fatalfln(message string, args ...interface{}) }
Logger contains advanced logging functions
type Sublogger ¶
type Sublogger struct { Module string DefaultLevel Level // contains filtered or unexported fields }
func (*Sublogger) Debug ¶
func (log *Sublogger) Debug(parts ...interface{})
Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func (*Sublogger) Debugf ¶
Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func (*Sublogger) Debugfln ¶
Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
func (*Sublogger) Debugln ¶
func (log *Sublogger) Debugln(parts ...interface{})
Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func (*Sublogger) Error ¶
func (log *Sublogger) Error(parts ...interface{})
Error formats the given parts with fmt.Sprint and logs the result with the Error level
func (*Sublogger) Errorf ¶
Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func (*Sublogger) Errorfln ¶
Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
func (*Sublogger) Errorln ¶
func (log *Sublogger) Errorln(parts ...interface{})
Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func (*Sublogger) Fatal ¶
func (log *Sublogger) Fatal(parts ...interface{})
Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func (*Sublogger) Fatalf ¶
Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func (*Sublogger) Fatalfln ¶
Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
func (*Sublogger) Fatalln ¶
func (log *Sublogger) Fatalln(parts ...interface{})
Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func (*Sublogger) Info ¶
func (log *Sublogger) Info(parts ...interface{})
Info formats the given parts with fmt.Sprint and logs the result with the Info level
func (*Sublogger) Infof ¶
Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func (*Sublogger) Infofln ¶
Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
func (*Sublogger) Infoln ¶
func (log *Sublogger) Infoln(parts ...interface{})
Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func (*Sublogger) Log ¶
Log formats the given parts with fmt.Sprint and logs the result with the given level
func (*Sublogger) Logf ¶
Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func (*Sublogger) Logfln ¶
Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func (*Sublogger) Logln ¶
Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func (*Sublogger) SetDefaultLevel ¶
SetDefaultLevel changes the default logging level of this Sublogger
func (*Sublogger) SetParent ¶
func (log *Sublogger) SetParent(parent *BasicLogger)
SetParent changes the parent of this Sublogger
func (*Sublogger) Warn ¶
func (log *Sublogger) Warn(parts ...interface{})
Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func (*Sublogger) Warnf ¶
Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
func (*Sublogger) Warnfln ¶
Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
func (*Sublogger) Warnln ¶
func (log *Sublogger) Warnln(parts ...interface{})
Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
func (*Sublogger) WithDefaultLevel ¶ added in v2.1.1
WithDefaultLevel creates a Sublogger with the same Module but different DefaultLevel