remove space. add back log.debug, log.backtrace flags with deprecation notice if they are set

This commit is contained in:
Jared Wasinger 2023-11-08 17:14:54 +08:00
parent db47dabe5e
commit 5e3efddbb0
2 changed files with 20 additions and 2 deletions

View file

@ -40,7 +40,6 @@ import (
"time"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils"

View file

@ -35,7 +35,6 @@ import (
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"gopkg.in/natefinch/lumberjack.v2"
"golang.org/x/exp/slog"
)
@ -77,6 +76,17 @@ var (
Usage: "Write logs to a file",
Category: flags.LoggingCategory,
}
backtraceAtFlag = &cli.StringFlag{
Name: "log.backtrace",
Usage: "Request a stack trace at a specific logging statement (e.g. \"block.go:271\")",
Value: "",
Category: flags.LoggingCategory,
}
debugFlag = &cli.BoolFlag{
Name: "log.debug",
Usage: "Prepends log messages with call-site location (file and line number)",
Category: flags.LoggingCategory,
}
logRotateFlag = &cli.BoolFlag{
Name: "log.rotate",
Usage: "Enables log file rotation",
@ -150,6 +160,8 @@ var (
var Flags = []cli.Flag{
verbosityFlag,
logVmoduleFlag,
backtraceAtFlag,
debugFlag,
vmoduleFlag,
logjsonFlag,
logFormatFlag,
@ -271,6 +283,13 @@ func Setup(ctx *cli.Context) error {
}
glogger.Vmodule(vmodule)
if ctx.IsSet(backtraceAtFlag.Name) {
defer log.Warn("The flag '--log.backtraceat' is depcrecated and should no longer be used.")
}
if ctx.IsSet(debugFlag.Name) {
defer log.Warn("The flag '--log.debug' is depcrecated and should no longer be used.")
}
log.SetDefault(log.NewLogger(glogger))
// profiling, tracing