Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func Debugf(format string, v ...any)
- func Errorf(format string, v ...any)
- func Infof(format string, v ...any)
- func InitLogger(appName string, o *Options)
- func SetAsync(async bool)
- func SetConfig(ops ...WithConfig)
- func SetLevel(level int)
- func SetLogger(nl Logger)
- func Warnf(format string, v ...any)
- type EmptyEntry
- type EmptyLogger
- func (l *EmptyLogger) Debugf(string, ...any)
- func (l *EmptyLogger) Errorf(string, ...any)
- func (l *EmptyLogger) Infof(string, ...any)
- func (l *EmptyLogger) SetLevel(int)
- func (l *EmptyLogger) Warnf(string, ...any)
- func (l *EmptyLogger) WithDebug(string) Entry
- func (l *EmptyLogger) WithError(string) Entry
- func (l *EmptyLogger) WithInfo(string) Entry
- func (l *EmptyLogger) WithWarn(string) Entry
- type Entry
- type Field
- type FieldCall
- type Fields
- type Logger
- type Options
- type Record
- type WithConfig
- func WithCompressConfig(compress bool) WithConfig
- func WithFileNameConfig(filename string, filterDefault bool) WithConfig
- func WithLevelConfig(level int, filterDefault bool) WithConfig
- func WithMaxAgeConfig(maxAge int, filterDefault bool) WithConfig
- func WithMaxBackupsConfig(maxBackups int, filterDefault bool) WithConfig
- func WithMaxSizeConfig(maxSize int, filterDefault bool) WithConfig
- type WithOption
- func WithAsyncOption(async bool) WithOption
- func WithCompressOption(compress bool) WithOption
- func WithFileNameOption(filename string, filterDefault bool) WithOption
- func WithLevelOption(level int, filterDefault bool) WithOption
- func WithMaxAgeOption(maxAge int, filterDefault bool) WithOption
- func WithMaxBackupsOption(maxBackups int, filterDefault bool) WithOption
- func WithMaxSizeOption(maxSize int, filterDefault bool) WithOption
- func WithOutDirOption(outDir string, filterDefault bool) WithOption
Constants ¶
View Source
const ( NoneLevel = iota // PanicLevel level, the highest level of severity. will call panic() if the logging level <= PanicLevel. PanicLevel // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level <= FatalLevel. FatalLevel // ErrorLevel level. Runtime errors. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // NoticeLevel level Uncommon events NoticeLevel // InfoLevel level. Examples: User logs in, SQL logs. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel )
Variables ¶
View Source
var DefaultEmptyEntry = &EmptyEntry{}
Functions ¶
func InitLogger ¶
func SetConfig ¶
func SetConfig(ops ...WithConfig)
Types ¶
type EmptyEntry ¶
type EmptyEntry struct{}
func (*EmptyEntry) Log ¶
func (l *EmptyEntry) Log()
func (*EmptyEntry) WithFields ¶
func (l *EmptyEntry) WithFields(Fields) Entry
func (*EmptyEntry) WithFormat ¶
func (l *EmptyEntry) WithFormat(string) Entry
func (*EmptyEntry) WithLevel ¶
func (l *EmptyEntry) WithLevel(int) Entry
type EmptyLogger ¶
type EmptyLogger struct{}
func (*EmptyLogger) Debugf ¶
func (l *EmptyLogger) Debugf(string, ...any)
func (*EmptyLogger) Errorf ¶
func (l *EmptyLogger) Errorf(string, ...any)
func (*EmptyLogger) Infof ¶
func (l *EmptyLogger) Infof(string, ...any)
func (*EmptyLogger) SetLevel ¶
func (l *EmptyLogger) SetLevel(int)
func (*EmptyLogger) Warnf ¶
func (l *EmptyLogger) Warnf(string, ...any)
func (*EmptyLogger) WithDebug ¶
func (l *EmptyLogger) WithDebug(string) Entry
func (*EmptyLogger) WithError ¶
func (l *EmptyLogger) WithError(string) Entry
func (*EmptyLogger) WithInfo ¶
func (l *EmptyLogger) WithInfo(string) Entry
func (*EmptyLogger) WithWarn ¶
func (l *EmptyLogger) WithWarn(string) Entry
type Entry ¶
type Options ¶
type Options struct { OutDir string `json:"out_dir" yaml:"out_dir" toml:"out_dir"` Filename string `json:"filename" yaml:"filename" toml:"filename"` MaxSize int `json:"max_size" yaml:"max_size" toml:"max_size"` MaxBackups int `json:"max_backups" yaml:"max_backups" toml:"max_backups"` MaxAge int `json:"max_age" yaml:"max_age" toml:"max_age"` Compress bool `json:"compress" yaml:"compress" toml:"compress"` Level int `json:"level" yaml:"level" toml:"level"` Async bool `json:"async" yaml:"async" toml:"async"` }
func NewOptions ¶
func NewOptions() Options
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
func (*Record) WithFields ¶
func (*Record) WithFormat ¶
type WithConfig ¶
func WithCompressConfig ¶
func WithCompressConfig(compress bool) WithConfig
func WithFileNameConfig ¶
func WithFileNameConfig(filename string, filterDefault bool) WithConfig
func WithLevelConfig ¶
func WithLevelConfig(level int, filterDefault bool) WithConfig
func WithMaxAgeConfig ¶
func WithMaxAgeConfig(maxAge int, filterDefault bool) WithConfig
func WithMaxBackupsConfig ¶
func WithMaxBackupsConfig(maxBackups int, filterDefault bool) WithConfig
func WithMaxSizeConfig ¶
func WithMaxSizeConfig(maxSize int, filterDefault bool) WithConfig
type WithOption ¶
type WithOption func(o *Options)
func WithAsyncOption ¶
func WithAsyncOption(async bool) WithOption
func WithCompressOption ¶
func WithCompressOption(compress bool) WithOption
func WithFileNameOption ¶
func WithFileNameOption(filename string, filterDefault bool) WithOption
func WithLevelOption ¶
func WithLevelOption(level int, filterDefault bool) WithOption
func WithMaxAgeOption ¶
func WithMaxAgeOption(maxAge int, filterDefault bool) WithOption
func WithMaxBackupsOption ¶
func WithMaxBackupsOption(maxBackups int, filterDefault bool) WithOption
func WithMaxSizeOption ¶
func WithMaxSizeOption(maxSize int, filterDefault bool) WithOption
func WithOutDirOption ¶
func WithOutDirOption(outDir string, filterDefault bool) WithOption
Click to show internal directories.
Click to hide internal directories.