Documentation ¶
Index ¶
- Constants
- func RefreshLogConfig(config *LogConfig)
- func SetLogConfig(config *LogConfig)
- type LogConfig
- type LogModuleConfig
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) DebugDynamic(getStr func() string)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Debugw(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorw(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) InfoDynamic(getStr func() string)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infow(msg string, keysAndValues ...interface{})
- func (l *Logger) Logger() *zap.SugaredLogger
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Panicw(msg string, keysAndValues ...interface{})
- func (l *Logger) SetLogger(logger *zap.SugaredLogger)
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Warnw(msg string, keysAndValues ...interface{})
- type LoggerIns
Constants ¶
const ( MODULE_REQUEST = "[Request]" MODULE_SYSTEM = "[System]" MODULE_BRIEF = "[Brief]" MODULE_EVENT = "[Event]" DefaultStackTraceLevel = "PANIC" )
Log module
Variables ¶
This section is empty.
Functions ¶
func RefreshLogConfig ¶
func RefreshLogConfig(config *LogConfig)
RefreshLogConfig refresh core levels of modules at initiation time of core module or refresh core levels of modules dynamically at running time.
func SetLogConfig ¶
func SetLogConfig(config *LogConfig)
SetLogConfig set the config of logger module, called in initialization of config module
Types ¶
type LogConfig ¶
LogConfig the config of core module
func DefaultLogConfig ¶
func DefaultLogConfig() *LogConfig
DefaultLogConfig create default config for core module
type LogModuleConfig ¶
type LogModuleConfig struct { LogLevelDefault string `yaml:"log_level_default"` LogLevels map[string]string `yaml:"log_levels"` FilePath string `yaml:"file_path"` MaxAge int `yaml:"max_age"` RotationTime int `yaml:"rotation_time"` RotationSize int64 `yaml:"rotation_size"` LogInConsole bool `yaml:"log_in_console"` ShowColor bool `yaml:"show_color"` StackTraceLevel string `yaml:"stack_trace_level"` }
LogModuleConfig 设置不同模块的日志
func GetDefaultLogModuleConfig ¶
func GetDefaultLogModuleConfig() LogModuleConfig
GetDefaultLogModuleConfig create a default core config of node
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is an implementation of service logger.
func GetLogger ¶
GetLogger find or create a Logger with module name, usually called in initialization of all module. After one module get the logger, the module can use it forever until the program terminate.
func GetLoggerByService ¶
GetLoggerByChain find the Logger object with module name and serviceName, usually called in initialization of all module. One module can get a logger for each chain, then logger can be use forever until the program terminate.
func (*Logger) DebugDynamic ¶
func (*Logger) InfoDynamic ¶
func (*Logger) Logger ¶
func (l *Logger) Logger() *zap.SugaredLogger
func (*Logger) SetLogger ¶
func (l *Logger) SetLogger(logger *zap.SugaredLogger)
SetLogger set logger.
type LoggerIns ¶
type LoggerIns struct { RequestLog LogModuleConfig `yaml:"request"` SystemLog LogModuleConfig `yaml:"system"` }