MCPcopy Create free account
hub / github.com/CPChain/chain / updateLogConfig

Function updateLogConfig

cmd/cpchain/config.go:68–92  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

66}
67
68func updateLogConfig(ctx *cli.Context) {
69 if ctx.IsSet(flags.VerbosityFlagName) {
70 verbosity := ctx.Uint(flags.VerbosityFlagName)
71 if verbosity > 5 {
72 log.Error("log level error, use default info level")
73 }
74 log.SetLevel(log.Level(verbosity))
75 }
76
77 if ctx.IsSet(flags.LineNumberFlagName) {
78 if ctx.Bool(flags.LineNumberFlagName) {
79 log.ShowFilename()
80 }
81 }
82
83 if ctx.IsSet(flags.LogFileFlagName) {
84 filename := ctx.String(flags.LogFileFlagName)
85 f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
86 if err != nil {
87 log.Error("Error: create output file of logger")
88 } else {
89 log.SetOutput(f)
90 }
91 }
92}
93
94func updateNodeGeneralConfig(ctx *cli.Context, cfg *node.Config) {
95 updateRunModeFlag(ctx)

Callers 1

updateNodeGeneralConfigFunction · 0.85

Calls 5

SetLevelMethod · 0.80
ShowFilenameMethod · 0.80
SetOutputMethod · 0.80
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected