Documentation ¶
Index ¶
- Constants
- Variables
- func Access(fields map[string]interface{}, msg string)
- func InitLogLevelFromEnv()
- func SetLogLevel()
- type Logger
- func (l *Logger) AddHook(hook logrus.Hook)
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) GetLevel() logrus.Level
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Init(config LoggerConfig) error
- func (l *Logger) IsDebugEnabled() bool
- func (l *Logger) IsErrorEnabled() bool
- func (l *Logger) IsFatalEnabled() bool
- func (l *Logger) IsInfoEnabled() bool
- func (l *Logger) IsWarnEnabled() bool
- func (l *Logger) SetFormatter(formatter logrus.Formatter)
- func (l *Logger) SetLevel(level string)
- func (l *Logger) SetOutput(out io.Writer)
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- func (l *Logger) WithCaller(calllevel int) *logrus.Entry
- func (l *Logger) WithError(err error) *logrus.Entry
- func (l *Logger) WithFields(fields logrus.Fields) *logrus.Entry
- type LoggerConfig
- type Option
Constants ¶
View Source
const ( ENV_LOG_LEVEL = "LOG_LEVEL" LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" LOG_LEVEL_WARN = "warn" LOG_LEVEL_ERROR = "error" DEFAULT_LOG_LEVEL = LOG_LEVEL_DEBUG )
Variables ¶
View Source
var AccessLog = NewLogger()
View Source
var Log = NewLogger()
Functions ¶
func InitLogLevelFromEnv ¶
func InitLogLevelFromEnv()
func SetLogLevel ¶
func SetLogLevel()
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
export the *Logger object
func (*Logger) Init ¶
func (l *Logger) Init(config LoggerConfig) error
create a new lumberjack logger
func (*Logger) IsDebugEnabled ¶
func (*Logger) IsErrorEnabled ¶
func (*Logger) IsFatalEnabled ¶
func (*Logger) IsInfoEnabled ¶
func (*Logger) IsWarnEnabled ¶
func (*Logger) SetFormatter ¶
sets the standard logger formatter.
type LoggerConfig ¶
type LoggerConfig struct { Level string `yaml:"Level"` FileName string `yaml:"FileName"` MaxBackups int `yaml:"MaxBackups"` MaxSize string `yaml:"MaxSize"` MaxAge int `yaml:"MaxAge"` Hooks []string // the name of plugin hook }
the config information for logging
func (*LoggerConfig) GetOption ¶
func (config *LoggerConfig) GetOption() (*Option, error)
Click to show internal directories.
Click to hide internal directories.