(ctx *cli.Context)
| 66 | } |
| 67 | |
| 68 | func 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 | |
| 94 | func updateNodeGeneralConfig(ctx *cli.Context, cfg *node.Config) { |
| 95 | updateRunModeFlag(ctx) |
no test coverage detected