Documentation ¶
Index ¶
- Constants
- func RefreshLogConfig(config *LogConfig)
- func SetLogConfig(config *LogConfig)
- type CMLogger
- func (l *CMLogger) Debug(args ...interface{})
- func (l *CMLogger) DebugDynamic(getStr func() string)
- func (l *CMLogger) Debugf(format string, args ...interface{})
- func (l *CMLogger) Debugw(msg string, keysAndValues ...interface{})
- func (l *CMLogger) Error(args ...interface{})
- func (l *CMLogger) Errorf(format string, args ...interface{})
- func (l *CMLogger) Errorw(msg string, keysAndValues ...interface{})
- func (l *CMLogger) Fatal(args ...interface{})
- func (l *CMLogger) Fatalf(format string, args ...interface{})
- func (l *CMLogger) Fatalw(msg string, keysAndValues ...interface{})
- func (l *CMLogger) Info(args ...interface{})
- func (l *CMLogger) InfoDynamic(getStr func() string)
- func (l *CMLogger) Infof(format string, args ...interface{})
- func (l *CMLogger) Infow(msg string, keysAndValues ...interface{})
- func (l *CMLogger) Logger() *zap.SugaredLogger
- func (l *CMLogger) Panic(args ...interface{})
- func (l *CMLogger) Panicf(format string, args ...interface{})
- func (l *CMLogger) Panicw(msg string, keysAndValues ...interface{})
- func (l *CMLogger) SetLogger(logger *zap.SugaredLogger)
- func (l *CMLogger) Warn(args ...interface{})
- func (l *CMLogger) Warnf(format string, args ...interface{})
- func (l *CMLogger) Warnw(msg string, keysAndValues ...interface{})
- type LogConfig
- type LogNodeConfig
Constants ¶
const ( MODULE_BLOCKCHAIN = "[Blockchain]" MODULE_NET = "[Net]" MODULE_STORAGE = "[Storage]" MODULE_SNAPSHOT = "[Snapshot]" MODULE_CONSENSUS = "[Consensus]" MODULE_TXPOOL = "[TxPool]" MODULE_CORE = "[Core]" MODULE_VM = "[Vm]" MODULE_RPC = "[Rpc]" MODULE_LEDGER = "[Ledger]" //nolint:golint,unused MODULE_CLI = "[Cli]" MODULE_CHAINCONF = "[ChainConf]" MODULE_ACCESS = "[Access]" MODULE_MONITOR = "[Monitor]" MODULE_SYNC = "[Sync]" MODULE_DPOS = "[DPoS]" MODULE_TXFILTER = "[TxFilter]" MODULE_BRIEF = "[Brief]" MODULE_EVENT = "[Event]" DefaultStackTraceLevel = "ERROR" )
Log module
Variables ¶
This section is empty.
Functions ¶
func RefreshLogConfig ¶
func RefreshLogConfig(config *LogConfig)
RefreshLogConfig refresh log levels of modules at initiation time of log module or refresh log 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 CMLogger ¶
type CMLogger struct {
// contains filtered or unexported fields
}
CMLogger is an implementation of chainmaker logger.
func GetLogger ¶
GetLogger find or create a CMLogger 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 GetLoggerByChain ¶
GetLoggerByChain find the CMLogger object with module name and chainId, 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 (*CMLogger) DebugDynamic ¶
func (*CMLogger) InfoDynamic ¶
func (*CMLogger) Logger ¶
func (l *CMLogger) Logger() *zap.SugaredLogger
func (*CMLogger) SetLogger ¶
func (l *CMLogger) SetLogger(logger *zap.SugaredLogger)
SetLogger set logger.
type LogConfig ¶
type LogConfig struct { ConfigFile string `mapstructure:"config_file"` SystemLog LogNodeConfig `mapstructure:"system"` BriefLog LogNodeConfig `mapstructure:"brief"` EventLog LogNodeConfig `mapstructure:"event"` }
LogConfig the config of log module
func DefaultLogConfig ¶
func DefaultLogConfig() *LogConfig
DefaultLogConfig create default config for log module
type LogNodeConfig ¶
type LogNodeConfig struct { LogLevelDefault string `mapstructure:"log_level_default"` LogLevels map[string]string `mapstructure:"log_levels"` FilePath string `mapstructure:"file_path"` MaxAge int `mapstructure:"max_age"` RotationTime int `mapstructure:"rotation_time"` RotationSize int64 `mapstructure:"rotation_size"` LogInConsole bool `mapstructure:"log_in_console"` ShowColor bool `mapstructure:"show_color"` StackTraceLevel string `mapstructure:"stack_trace_level"` }
LogNodeConfig the log config of node
func GetDefaultLogNodeConfig ¶
func GetDefaultLogNodeConfig() LogNodeConfig
GetDefaultLogNodeConfig create a default log config of node