cmd/geth: rename --vmodule to --log.vmodule (#27071)

renames `--vmodule` to `--log.vmodule`, and prints a warning if the old form is used.
This commit is contained in:
Adrian Sutton 2023-04-19 21:18:02 +10:00 committed by GitHub
parent 2b0a34bea6
commit f2df2b1981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,10 +45,17 @@ var (
Value: 3, Value: 3,
Category: flags.LoggingCategory, Category: flags.LoggingCategory,
} }
logVmoduleFlag = &cli.StringFlag{
Name: "log.vmodule",
Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)",
Value: "",
Category: flags.LoggingCategory,
}
vmoduleFlag = &cli.StringFlag{ vmoduleFlag = &cli.StringFlag{
Name: "vmodule", Name: "vmodule",
Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)", Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)",
Value: "", Value: "",
Hidden: true,
Category: flags.LoggingCategory, Category: flags.LoggingCategory,
} }
logjsonFlag = &cli.BoolFlag{ logjsonFlag = &cli.BoolFlag{
@ -149,6 +156,7 @@ var (
// Flags holds all command-line flags required for debugging. // Flags holds all command-line flags required for debugging.
var Flags = []cli.Flag{ var Flags = []cli.Flag{
verbosityFlag, verbosityFlag,
logVmoduleFlag,
vmoduleFlag, vmoduleFlag,
backtraceAtFlag, backtraceAtFlag,
debugFlag, debugFlag,
@ -252,7 +260,14 @@ func Setup(ctx *cli.Context) error {
// logging // logging
verbosity := ctx.Int(verbosityFlag.Name) verbosity := ctx.Int(verbosityFlag.Name)
glogger.Verbosity(log.Lvl(verbosity)) glogger.Verbosity(log.Lvl(verbosity))
vmodule := ctx.String(vmoduleFlag.Name) vmodule := ctx.String(logVmoduleFlag.Name)
if vmodule == "" {
// Retain backwards compatibility with `--vmodule` flag if `--log.vmodule` not set
vmodule = ctx.String(vmoduleFlag.Name)
if vmodule != "" {
defer log.Warn("The flag '--vmodule' is deprecated, please use '--log.vmodule' instead")
}
}
glogger.Vmodule(vmodule) glogger.Vmodule(vmodule)
debug := ctx.Bool(debugFlag.Name) debug := ctx.Bool(debugFlag.Name)