Documentation
¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Eventf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func FatalIf(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func IgnoreErrf(err error, format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func LevelToString(level logrus.Level) string
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func Set(out io.Writer)
- func SetFormatter(formatter logrus.Formatter)
- func SetLevel(level logrus.Level)
- func SetLevelStr(level string) error
- func SetLoggerFormatter(lo *Logger, formatter logrus.Formatter)
- func SetLoggerLevel(lo *Logger, level string) error
- func SetOutput(out io.Writer)
- func StdoutPrintf(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warning(args ...interface{})
- func Warningf(format string, args ...interface{})
- func Warningln(args ...interface{})
- func Warnln(args ...interface{})
- func WithError(err error) *logrus.Entry
- func WithField(key string, value interface{}) *logrus.Entry
- func WithFields(fields logrus.Fields) *logrus.Entry
- type FileConfig
- type Logger
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreErrf ¶ added in v1.3.67
func LevelToString ¶
Convert the Level to a string. E.g. PanicLevel becomes "panic".
func SetFormatter ¶
func SetLevelStr ¶
func SetLoggerFormatter ¶
func SetLoggerLevel ¶
func StdoutPrintf ¶
func StdoutPrintf(format string, args ...interface{})
Types ¶
type FileConfig ¶
type FileConfig struct { Filename string `vx_default:"main"` // MaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. MaxSize int `vx_default:"10"` // 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 `vx_default:"7"` // 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 `vx_default:"5"` // LocalTime determines if the time used for formatting the timestamps in // backup files is the computer's local time. The default is to use UTC // time. LocalTime bool `vx_default:"true"` // Compress determines if the rotated log files should be compressed // using gzip. The default is not to perform compression. Compress bool `vx_default:"true"` }
type Logger ¶ added in v1.3.48
func SetLoggerOutput ¶
func SetLoggerOutput(lo *Logger, pCtx context.Context, cfg FileConfig) *Logger
func StandardLogger ¶
func StandardLogger() *Logger
type TextFormatter ¶
type TextFormatter struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool // Force disabling colors. DisableColors bool // Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool // Disables the truncation of the level text to 4 characters. DisableLevelTruncation bool // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool // Show Field Keys // true: time="2020-02-22T21:33:31+08:00" level=info msg="File read done:conf/input!" // false: "2020-02-22T21:42:57+08:00" info "Start all services..." EnableFieldKey bool // show file:line DisableFileLine bool // need quote EnableQuoting bool sync.Once // contains filtered or unexported fields }
TextFormatter formats logs into text
Click to show internal directories.
Click to hide internal directories.