mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
remove extra spaces. add test for nil big.Int/uint256.Int. move log.backtrace/log.debug flags to flags_legacy.go
This commit is contained in:
parent
5e3efddbb0
commit
46b65e228b
7 changed files with 25 additions and 26 deletions
|
|
@ -144,6 +144,8 @@ var (
|
|||
utils.GpoMaxGasPriceFlag,
|
||||
utils.GpoIgnoreGasPriceFlag,
|
||||
configFileFlag,
|
||||
utils.DebugFlag,
|
||||
utils.BacktraceAtFlag,
|
||||
}, utils.NetworkFlags, utils.DatabaseFlags)
|
||||
|
||||
rpcFlags = []cli.Flag{
|
||||
|
|
|
|||
|
|
@ -1459,6 +1459,13 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
log.Info(fmt.Sprintf("Using %s as db engine", dbEngine))
|
||||
cfg.DBEngine = dbEngine
|
||||
}
|
||||
// deprecation notice for log debug flags (TODO: find a more appropriate place to put these?)
|
||||
if ctx.IsSet(BacktraceAtFlag.Name) {
|
||||
log.Warn("log.backtrace flag is deprecated")
|
||||
}
|
||||
if ctx.IsSet(DebugFlag.Name) {
|
||||
log.Warn("log.debug flag is deprecated")
|
||||
}
|
||||
}
|
||||
|
||||
func setSmartCard(ctx *cli.Context, cfg *node.Config) {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,18 @@ var (
|
|||
Value: ethconfig.Defaults.TransactionHistory,
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated November 2023
|
||||
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,
|
||||
}
|
||||
)
|
||||
|
||||
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
|
||||
|
|
|
|||
|
|
@ -76,17 +76,6 @@ 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",
|
||||
|
|
@ -160,8 +149,6 @@ var (
|
|||
var Flags = []cli.Flag{
|
||||
verbosityFlag,
|
||||
logVmoduleFlag,
|
||||
backtraceAtFlag,
|
||||
debugFlag,
|
||||
vmoduleFlag,
|
||||
logjsonFlag,
|
||||
logFormatFlag,
|
||||
|
|
@ -283,13 +270,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -275,15 +275,15 @@ func builtinReplace(_ []string, attr slog.Attr) slog.Attr {
|
|||
attr = slog.Any(attr.Key, v.Format(timeFormat))
|
||||
case *big.Int:
|
||||
if v == nil {
|
||||
attr.Value = slog.AnyValue("<nil>")
|
||||
attr.Value = slog.StringValue("<nil>")
|
||||
} else {
|
||||
attr.Value = slog.AnyValue(v.String())
|
||||
attr.Value = slog.StringValue(v.String())
|
||||
}
|
||||
case *uint256.Int:
|
||||
if v == nil {
|
||||
attr.Value = slog.AnyValue("<nil>")
|
||||
attr.Value = slog.StringValue("<nil>")
|
||||
} else {
|
||||
attr.Value = slog.AnyValue(v.ToBig().String())
|
||||
attr.Value = slog.StringValue(v.Dec())
|
||||
}
|
||||
}
|
||||
return attr
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import (
|
|||
"os"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/mattn/go-colorable"
|
||||
|
|
|
|||
Loading…
Reference in a new issue