Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...any)
- func Debugf(format string, args ...any)
- func Error(args ...any)
- func Errorf(format string, args ...any)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func Info(args ...any)
- func Infof(format string, args ...any)
- func Panic(args ...any)
- func Panicf(format string, args ...any)
- func SetOptions(opts ...Option)
- func Warn(args ...any)
- func Warnf(format string, args ...any)
- func Writer() io.Writer
- type Entry
- type Formatter
- type JsonFormatter
- type Level
- type Logger
- func (l *Logger) Debug(args ...any)
- func (l *Logger) Debugf(format string, args ...any)
- func (l *Logger) Error(args ...any)
- func (l *Logger) Errorf(format string, args ...any)
- func (l *Logger) Fatal(args ...any)
- func (l *Logger) Fatalf(format string, args ...any)
- func (l *Logger) Info(args ...any)
- func (l *Logger) Infof(format string, args ...any)
- func (l *Logger) Panic(args ...any)
- func (l *Logger) Panicf(format string, args ...any)
- func (l *Logger) SetOptions(opts ...Option)
- func (l *Logger) Warn(args ...any)
- func (l *Logger) Warnf(format string, args ...any)
- func (l *Logger) Write(data []byte) (int, error)
- func (l *Logger) Writer() io.Writer
- type Option
- type TextFormatter
Constants ¶
View Source
const (
FmtEmptySeparate = ""
)
Variables ¶
View Source
var LevelNameMapping = map[Level]string{ DebugLevel: "DEBUG", InfoLevel: "INFO", WarnLevel: "WARN", ErrorLevel: "ERROR", PanicLevel: "PANIC", FatalLevel: "FATAL", }
log level string name mapping
Functions ¶
func SetOptions ¶
func SetOptions(opts ...Option)
Types ¶
type JsonFormatter ¶
type JsonFormatter struct {
IgnoreBasicFields bool
}
func (*JsonFormatter) Format ¶
func (f *JsonFormatter) Format(e *Entry) error
type Level ¶
type Level uint8
log level
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
const log level
func (*Level) UnmarshalText ¶
UnmarshalText unmarshal text to a level.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) SetOptions ¶
type Option ¶
type Option func(*options)
func WithDisableCaller ¶
func WithFormatter ¶
func WithOutput ¶
func WithStdLevel ¶
type TextFormatter ¶
type TextFormatter struct {
IgnoreBasicFields bool
}
func (*TextFormatter) Format ¶
func (f *TextFormatter) Format(e *Entry) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.