Documentation ¶
Overview ¶
Package logger contains spv logs for each module
Index ¶
Constants ¶
View Source
const ( ModuleCli = "[Cli]" ModuleSpv = "[SPV]" ModuleStateManager = "[StateManager]" ModuleReqManager = "[ReqManager]" ModuleBlockManager = "[BlockManager]" ModuleStateDB = "[StateDB]" ModuleProver = "[Prover]" ModuleRpc = "[Rpc]" ModuleWeb = "[Web]" ModuleSdk = "[Sdk]" )
module log name
View Source
const ( DEBUG = "DEBUG" INFO = "INFO" WARN = "WARN" ERROR = "ERROR" )
log level
View Source
const ( DefaultMaxAge = 365 // maximum log retention time,unit:day DefaultRotationTime = 6 // log scrolling interval,unit:hour )
default config of log cutting
Variables ¶
This section is empty.
Functions ¶
func GetDefaultLogger ¶
func GetDefaultLogger() *zap.SugaredLogger
GetDefaultLogger creates default logger
func GetLogger ¶
func GetLogger(name string) *zap.SugaredLogger
GetLogger finds or creates a logger with module name, usually called in initialization of all module.
Types ¶
type Config ¶
type Config struct { Module string // module: module name LogPath string // logPath: logger file save path LogLevel LogLevel // logLevel: logger level MaxAge int // maxAge: the maximum number of days to retain old logger files RotationTime int // RotationTime: rotation time JsonFormat bool // jsonFormat: logger file use json format ShowLine bool // showLine: show filename and line number LogInConsole bool // logInConsole: show logs in console at the same time ShowColor bool // if true, show color logger }
type LogConfig ¶
type LogConfig struct { ConfigFile string `mapstructure:"config_file"` SystemLog LogNodeConfig `mapstructure:"system"` }
LogConfig is the config of logger module
type LogNodeConfig ¶
type LogNodeConfig struct { LogLevel string `mapstructure:"log_level"` FilePath string `mapstructure:"file_path"` MaxAge int `mapstructure:"max_age"` RotationTime int `mapstructure:"rotation_time"` LogInConsole bool `mapstructure:"log_in_console"` ShowColor bool `mapstructure:"show_color"` }
LogNodeConfig is the logger config of node
Click to show internal directories.
Click to hide internal directories.