Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureLogger(moduleName string) *logrus.Entry
- type LogApi
- type LogConfig
- type LogService
- func (logService *LogService) Api() []app.API
- func (logService *LogService) CommandFlags() ([]cli.Command, []cli.Flag)
- func (logService *LogService) DefaultConfig() *LogConfig
- func (logService *LogService) Init(executeContext *app.ExecuteContext) error
- func (logService *LogService) Name() string
- func (logService *LogService) P2pMessages() map[int]interface{}
- func (logService *LogService) Receive(context actor.Context)
- func (logService *LogService) Start(executeContext *app.ExecuteContext) error
- func (logService *LogService) Stop(executeContext *app.ExecuteContext) error
- type ModuleHook
- type NullFormat
Constants ¶
View Source
const (
MODULE = "MODULE"
)
Variables ¶
View Source
var ( //log LogDirFlag = common.DirectoryFlag{ Name: "logdir", Usage: "Directory for the logdir (default = inside the homedir)", } LogLevelFlag = cli.IntFlag{ Name: "loglevel", Usage: "Logging level: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail", Value: 3, } VmoduleFlag = cli.StringFlag{ Name: "vmodule", Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)", Value: "", } )
View Source
var (
DefaultLogConfig = &LogConfig{
LogLevel: 3,
}
)
Functions ¶
func EnsureLogger ¶
EnsureLogger create logger int other file
Types ¶
type LogApi ¶
type LogApi struct {
// contains filtered or unexported fields
}
name: 日志rpc接口 usage: 设置日志级别 prefix:log
func NewLogApi ¶
func NewLogApi(hook *ModuleHook) *LogApi
func (*LogApi) SetLevel ¶
name: setLevel usage: 设置日志级别 params: 1. 日志级别("debug","0") return: 无 example: curl http://localhost:15645 -X POST --data '{"jsonrpc":"2.0","method":"log_setLevel","params":["trace"], "id": 3}' -H "Content-Type:application/json" response: {"jsonrpc":"2.0","id":3,"result":null}
func (*LogApi) SetVmodule ¶
name: setVmodule usage: 分模块设置级别 params: 1. 模块日志级别(txpool=5) return: 无 example: curl http://localhost:15645 -X POST --data '{"jsonrpc":"2.0","method":"log_setVmodule","params":["txpool=5"], "id": 3}' -H "Content-Type:application/json" response: {"jsonrpc":"2.0","id":3,"result":null}
type LogService ¶
type LogService struct { Config *LogConfig // contains filtered or unexported fields }
LogService provier log config and control
func (*LogService) Api ¶
func (logService *LogService) Api() []app.API
Name log api to control log function
func (*LogService) CommandFlags ¶
func (logService *LogService) CommandFlags() ([]cli.Command, []cli.Flag)
CommandFlags export flag to control log while app running
func (*LogService) DefaultConfig ¶
func (logService *LogService) DefaultConfig() *LogConfig
func (*LogService) Init ¶
func (logService *LogService) Init(executeContext *app.ExecuteContext) error
Init init log format and output
func (*LogService) P2pMessages ¶
func (logService *LogService) P2pMessages() map[int]interface{}
P2pMessages no p2p msg for log
func (*LogService) Start ¶
func (logService *LogService) Start(executeContext *app.ExecuteContext) error
Start
func (*LogService) Stop ¶
func (logService *LogService) Stop(executeContext *app.ExecuteContext) error
Stop
type ModuleHook ¶
type ModuleHook struct {
// contains filtered or unexported fields
}
ModuleHook use custom hooks to redefine log input and output, module control, level control
func (*ModuleHook) Levels ¶
func (hook *ModuleHook) Levels() []log.Level
func (*ModuleHook) SetLevel ¶
func (hook *ModuleHook) SetLevel(lvInt log.Level)
func (*ModuleHook) SetModulesLevel ¶
func (hook *ModuleHook) SetModulesLevel(moduleLevel ...interface{}) error
Click to show internal directories.
Click to hide internal directories.