Documentation ¶
Index ¶
- func FindCaller(callerSkip int) (lastCaller, allCallers string)
- type Field
- type ILogger
- type Level
- type Logger
- func (l *Logger) Debug(msg string, fields ...Field)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Enable(level Level) bool
- func (l *Logger) Error(msg string, fields ...Field)
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(msg string, fields ...Field)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(msg string, fields ...Field)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Log(msg string, level Level, fields ...Field)
- func (l *Logger) Logf(level Level, format string, v ...interface{})
- func (l *Logger) Panic(msg string, fields ...Field)
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Warn(msg string, fields ...Field)
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Write(msg []byte)
- type Option
- func WithCallerSkip(callerSkip int) Option
- func WithCompress(compress bool) Option
- func WithFields(fields ...Field) Option
- func WithInterval(interval time.Duration) Option
- func WithLevel(level string) Option
- func WithMaxAge(maxAge int) Option
- func WithMaxBackups(maxBackups int) Option
- func WithMaxSize(maxSize int) Option
- func WithName(name string) Option
- func WithOutType(outType string) Option
- func WithPath(path string) Option
- type RotateWriter
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindCaller ¶
Types ¶
type ILogger ¶
type ILogger interface { Write(msg []byte) Enable(level Level) bool Log(msg string, level Level, fields ...Field) Logf(level Level, format string, v ...interface{}) Debug(msg string, fields ...Field) Info(msg string, fields ...Field) Infof(format string, args ...interface{}) Warn(msg string, fields ...Field) Warnf(format string, args ...interface{}) Error(msg string, fields ...Field) Errorf(format string, args ...interface{}) Panic(msg string, fields ...Field) Panicf(format string, args ...interface{}) Fatal(msg string, fields ...Field) Fatalf(format string, args ...interface{}) }
func NewWithOptions ¶
type Level ¶
type Level uint8
type Option ¶
type Option func(l *Logger)
func WithCallerSkip ¶
func WithCompress ¶
func WithFields ¶
func WithInterval ¶
func WithMaxAge ¶
func WithMaxBackups ¶
func WithMaxSize ¶
func WithOutType ¶
type RotateWriter ¶
type RotateWriter struct { // Filename is the file to write logs to. Backup log files will be retained // in the same directory. It uses <processname>-rotate.log in // os.TempDir() if empty. Filename string // MaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. MaxSize int // MaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. MaxAge int // MaxBackups is the maximum number of old log files to retain. The default // is to retain all old log files (though MaxAge may still cause them to get // deleted.) MaxBackups int // Compress determines if the rotated log files should be compressed // using gzip. The default is not to perform compression. Compress bool // Interval determines the duration to rotate log files. // The default is not to rotate log files based on time. Interval time.Duration // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.