From afc4b35e0af22084bf2e686a78a8446f58bfb418 Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Thu, 8 Feb 2024 21:11:18 +0100 Subject: [PATCH] Fix log defaults --- README.md | 2 +- klog.go | 12 ++++++++---- main.go | 5 ++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 21e6b0d9..e5e4e67c 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ The `proxyFailedRequests` flag will make the RPC server proxy not only RPC metho ### Log Levels -You can set the desired log verbosity level by using the `-v` flag. The levels are from 0 to 5, where 0 is the least verbose and 5 is the most verbose. The default level is 3. +You can set the desired log verbosity level by using the `-v` flag. The levels are from 0 to 5, where 0 is the least verbose and 5 is the most verbose. The default level is 2. Example: diff --git a/klog.go b/klog.go index da0dd458..ef1cee8e 100644 --- a/klog.go +++ b/klog.go @@ -12,6 +12,10 @@ func NewKlogFlagSet() []cli.Flag { fs := flag.NewFlagSet("klog", flag.PanicOnError) klog.InitFlags(fs) + fs.Set("v", "2") + fs.Set("log_file_max_size", "1800") + fs.Set("logtostderr", "true") + return []cli.Flag{ // "log_dir", "", "If non-empty, write log files in this directory (no effect when -logtostderr=true)") &cli.StringFlag{ @@ -73,10 +77,10 @@ func NewKlogFlagSet() []cli.Flag { }, // "v", "number for the log level verbosity") &cli.IntFlag{ - Name: "v", - Usage: "number for the log level verbosity", - EnvVars: []string{"FAITHFUL_V"}, - DefaultText: "3", + Name: "v", + Usage: "number for the log level verbosity", + EnvVars: []string{"FAITHFUL_V"}, + Value: 2, Action: func(cctx *cli.Context, v int) error { fs.Set("v", fmt.Sprint(v)) return nil diff --git a/main.go b/main.go index d2e43971..e75a044b 100644 --- a/main.go +++ b/main.go @@ -44,7 +44,10 @@ func main() { Version: gitCommitSHA, Description: "CLI to get, manage and interact with the Solana blockchain data stored in a CAR file or on Filecoin/IPFS.", Flags: NewKlogFlagSet(), - Action: nil, + Before: func(cctx *cli.Context) error { + return nil + }, + Action: nil, Commands: []*cli.Command{ newCmd_DumpCar(), fetchCmd,