Documentation ¶
Index ¶
- Constants
- Variables
- type FileWriter
- type Level
- type Logger
- func (l *Logger) Debug(args ...any)
- func (l *Logger) Error(args ...any)
- func (l *Logger) Fatal(args ...any)
- func (l *Logger) Info(args ...any)
- func (l *Logger) Log(level Level, args ...any)
- func (l *Logger) Panic(args ...any)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetOutput(out io.Writer)
- func (l *Logger) SetTimeLayout(layout string)
- func (l *Logger) Warn(args ...any)
- func (l *Logger) Write(p []byte) (n int, err error)
- type Option
Constants ¶
View Source
const ( DebugLevel = Level(iota) InfoLevel WarnLevel ErrorLevel PanicLevel FatalLevel )
Variables ¶
View Source
var LevelMap = map[Level]string{ DebugLevel: "debug", InfoLevel: "info", WarnLevel: "warn", ErrorLevel: "error", PanicLevel: "panic", FatalLevel: "fatal", }
LevelMap maps a level to a string.
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶ added in v1.0.2
type FileWriter struct {
// contains filtered or unexported fields
}
func NewFileWriter ¶ added in v1.0.2
func NewFileWriter(opt *Option) *FileWriter
NewFileWriter creates a new FileWriter.
func (*FileWriter) Close ¶ added in v1.0.2
func (l *FileWriter) Close() error
Close closes the logger.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Fatal ¶
Fatal writes a message to the log using the FATAL level. The process will exit with status set to 1.
func (*Logger) Panic ¶ added in v1.0.3
Panic writes a message to the log using the PANIC level. The process will panic after writing the message.
func (*Logger) SetTimeLayout ¶
SetTimeLayout sets the time layout.
Click to show internal directories.
Click to hide internal directories.