Documentation
¶
Index ¶
- Constants
- func CreateLogger(basicConfig *microConf.BasicConfig, logConfig *conf.LogConfig) (*zap.Logger, error)
- type ILogger
- type LoggerGroup
- type NoopLogger
- func (l *NoopLogger) Debug(args ...interface{})
- func (l *NoopLogger) Debugf(string, ...interface{})
- func (l *NoopLogger) Debugw(string, ...interface{})
- func (l *NoopLogger) Error(args ...interface{})
- func (l *NoopLogger) Errorf(string, ...interface{})
- func (l *NoopLogger) Errorw(string, ...interface{})
- func (l *NoopLogger) Fatal(...interface{})
- func (l *NoopLogger) Fatalf(string, ...interface{})
- func (l *NoopLogger) Fatalln(...interface{})
- func (l *NoopLogger) Fatalw(string, ...interface{})
- func (l *NoopLogger) Info(args ...interface{})
- func (l *NoopLogger) Infof(string, ...interface{})
- func (l *NoopLogger) Infow(string, ...interface{})
- func (l *NoopLogger) Panic(...interface{})
- func (l *NoopLogger) Panicf(string, ...interface{})
- func (l *NoopLogger) Panicln(...interface{})
- func (l *NoopLogger) Panicw(string, ...interface{})
- func (l *NoopLogger) Print(...interface{})
- func (l *NoopLogger) Printf(string, ...interface{})
- func (l *NoopLogger) Println(...interface{})
- func (l *NoopLogger) Warn(args ...interface{})
- func (l *NoopLogger) Warnf(string, ...interface{})
- func (l *NoopLogger) Warnw(string, ...interface{})
Constants ¶
View Source
const ( // LevelDebug logs are typically voluminous, and are usually disabled in production. LevelDebug = "DEBUG" // LevelInfo is the default logging priority. LevelInfo = "INFO" // LevelWarn logs are more important than Info, but don't need individual human review. LevelWarn = "WARN" // LevelError logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. LevelError = "ERROR" // LevelDPanic logs are particularly important errors. In development the // logger panics after writing the message. LevelDPanic = "DPANIC" // LevelPanic logs a message, then panics. LevelPanic = "PANIC" // LevelFatal logs a message, then calls os.Exit(1). LevelFatal = "FATAL" )
Variables ¶
This section is empty.
Functions ¶
func CreateLogger ¶
func CreateLogger(basicConfig *microConf.BasicConfig, logConfig *conf.LogConfig) (*zap.Logger, error)
CreateLogger create a logger
Types ¶
type ILogger ¶
type ILogger interface { Debugw(string, ...interface{}) Infow(string, ...interface{}) Warnw(string, ...interface{}) Errorw(string, ...interface{}) Panicw(string, ...interface{}) Fatalw(string, ...interface{}) Panic(args ...interface{}) Fatal(args ...interface{}) Error(args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Debugf(string, ...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Errorf(string, ...interface{}) Fatalf(string, ...interface{}) Panicf(string, ...interface{}) }
ILogger log interface
type LoggerGroup ¶
type LoggerGroup struct {
// contains filtered or unexported fields
}
LoggerGroup is a group of logger, which provide loggers w/ different levels for modules
func CreateLoggerGroup ¶
func CreateLoggerGroup(basicConfig *microConf.BasicConfig, logConfig *conf.LogGroupConfig) (*LoggerGroup, error)
CreateLoggerGroup create a logger group
func (*LoggerGroup) GetLevels ¶
func (l *LoggerGroup) GetLevels() map[string]string
GetLevels return log levels of each module
func (*LoggerGroup) M ¶
func (l *LoggerGroup) M(module string) ILogger
M return the logger for the module, will return logger w/ INFO level if level is not set for the module
func (*LoggerGroup) SetLevel ¶
func (l *LoggerGroup) SetLevel(module, level string)
SetLevel set log level for the module, which can be called in runtime
func (*LoggerGroup) Sync ¶
func (l *LoggerGroup) Sync() error
Sync calls the underlying Core's Sync method
Click to show internal directories.
Click to hide internal directories.