logger

package module
v0.0.0-...-270506c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

README

logger

介绍

perseus 链日志组件

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

View Source
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

func GetLogger(name string) *CMLogger

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

func GetLoggerByChain(name, chainId string) *CMLogger

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) Debug

func (l *CMLogger) Debug(args ...interface{})

func (*CMLogger) DebugDynamic

func (l *CMLogger) DebugDynamic(getStr func() string)

func (*CMLogger) Debugf

func (l *CMLogger) Debugf(format string, args ...interface{})

func (*CMLogger) Debugw

func (l *CMLogger) Debugw(msg string, keysAndValues ...interface{})

func (*CMLogger) Error

func (l *CMLogger) Error(args ...interface{})

func (*CMLogger) Errorf

func (l *CMLogger) Errorf(format string, args ...interface{})

func (*CMLogger) Errorw

func (l *CMLogger) Errorw(msg string, keysAndValues ...interface{})

func (*CMLogger) Fatal

func (l *CMLogger) Fatal(args ...interface{})

func (*CMLogger) Fatalf

func (l *CMLogger) Fatalf(format string, args ...interface{})

func (*CMLogger) Fatalw

func (l *CMLogger) Fatalw(msg string, keysAndValues ...interface{})

func (*CMLogger) Info

func (l *CMLogger) Info(args ...interface{})

func (*CMLogger) InfoDynamic

func (l *CMLogger) InfoDynamic(getStr func() string)

func (*CMLogger) Infof

func (l *CMLogger) Infof(format string, args ...interface{})

func (*CMLogger) Infow

func (l *CMLogger) Infow(msg string, keysAndValues ...interface{})

func (*CMLogger) Logger

func (l *CMLogger) Logger() *zap.SugaredLogger

func (*CMLogger) Panic

func (l *CMLogger) Panic(args ...interface{})

func (*CMLogger) Panicf

func (l *CMLogger) Panicf(format string, args ...interface{})

func (*CMLogger) Panicw

func (l *CMLogger) Panicw(msg string, keysAndValues ...interface{})

func (*CMLogger) SetLogger

func (l *CMLogger) SetLogger(logger *zap.SugaredLogger)

SetLogger set logger.

func (*CMLogger) Warn

func (l *CMLogger) Warn(args ...interface{})

func (*CMLogger) Warnf

func (l *CMLogger) Warnf(format string, args ...interface{})

func (*CMLogger) Warnw

func (l *CMLogger) Warnw(msg string, keysAndValues ...interface{})

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL