From 25bc4efcd93ad0e05a28d7905a567488fef89c52 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Sat, 8 Apr 2023 11:54:25 +1000 Subject: [PATCH] cmd/geth: Rename --vmodule to --log.vmodule Backwards compatibility for --vmodule is preserved if --log.vmodule isn't specified with a warning logged. --- internal/debug/flags.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 3c8b569b4f38..d425a17db42b 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -45,10 +45,17 @@ var ( Value: 3, Category: flags.LoggingCategory, } + logVmoduleFlag = &cli.StringFlag{ + Name: "log.vmodule", + Usage: "Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)", + Value: "", + Category: flags.LoggingCategory, + } vmoduleFlag = &cli.StringFlag{ Name: "vmodule", Usage: "Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)", Value: "", + Hidden: true, Category: flags.LoggingCategory, } logjsonFlag = &cli.BoolFlag{ @@ -149,6 +156,7 @@ var ( // Flags holds all command-line flags required for debugging. var Flags = []cli.Flag{ verbosityFlag, + logVmoduleFlag, vmoduleFlag, backtraceAtFlag, debugFlag, @@ -252,7 +260,14 @@ func Setup(ctx *cli.Context) error { // logging verbosity := ctx.Int(verbosityFlag.Name) 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) debug := ctx.Bool(debugFlag.Name)