Documentation
¶
Index ¶
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func Fatal(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func SetDefaultLog(logger BoxLogger)
- func Warn(format string, args ...interface{})
- type BoxLogger
- type Level
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoxLogger ¶
type BoxLogger interface {
// Init initialises options
Init(options ...Option) error
// Options the Logger options
Options() *Options
// Log writes a log entry
Log(level Level, v ...interface{})
// Logf writes a formatted log entry
Logf(level Level, format string, v ...interface{})
// Named will create child logger with prefix
Named(string) BoxLogger
// Children will return a children with new option !
Children(...Option) BoxLogger
Debug(string, ...interface{})
Info(string, ...interface{})
Warn(string, ...interface{})
Error(string, ...interface{})
Fatal(string, ...interface{})
}
type Level ¶
type Level int8
func GetLevel ¶
GetLevel converts a level string into a logger Level value. returns an error if the input string does not match known values.
type Option ¶
type Option func(*Options)
func WithAppName ¶
func WithCallerSkipCount ¶
WithCallerSkipCount set frame count to skip
func WithOutput ¶
WithOutput set default output writer for the logger
type Options ¶
type Options struct {
// AppName is application nickname
AppName string
//LevelStr is human-readable level config
LevelStr string `yaml:"level"`
// The logging level the logger should log at. default is `InfoLevel`
LogLevel Level
//Outs logging out way, like console file or other
Outs []string `yaml:"mode"`
//LogFile is log file name
LogFile string `yaml:"outfile"`
//Style will determine the format of log, like json or console line !
Style string `yaml:"style"`
//TimeFormat format time with layout like 2006-01-02 15:04:05
TimeFormat string `yaml:"time_format"`
// Caller skip frame count for file:line info
CallerSkipCount int `yaml:"caller_skip_count"`
// TraceLevel will add stack trace, must greater than info. default close
TraceLevel string `yaml:"trace_level"`
//TimeSplit will split log by time
TimeSplit string `yaml:"time_split"`
//SizeSplit will split log by size
SizeSplit int64 `yaml:"size_split"`
// Alternative options
Context context.Context
}
Click to show internal directories.
Click to hide internal directories.