From b22403b557633889c469202b20a902c781fc4dcc Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Wed, 26 Jan 2022 14:30:50 +0000 Subject: [PATCH] Pretty log levels at start --- cmd/gossamer/config.go | 2 +- dot/config.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/gossamer/config.go b/cmd/gossamer/config.go index c91c27b8b0..740a12186d 100644 --- a/cmd/gossamer/config.go +++ b/cmd/gossamer/config.go @@ -123,7 +123,7 @@ func createDotConfig(ctx *cli.Context) (*dot.Config, error) { // TODO: log this better. // See https://github.com/ChainSafe/gossamer/issues/1945 - logger.Infof("loaded package log configuration: %#v", cfg.Log) + logger.Infof("loaded package log configuration: %s", cfg.Log) // set global configuration values if err := setDotGlobalConfig(ctx, tomlCfg, &cfg.Global); err != nil { diff --git a/dot/config.go b/dot/config.go index dc2e12571f..1a56fe525e 100644 --- a/dot/config.go +++ b/dot/config.go @@ -63,6 +63,21 @@ type LogConfig struct { FinalityGadgetLvl log.Level } +func (l LogConfig) String() string { + entries := []string{ + fmt.Sprintf("core: %s", l.CoreLvl), + fmt.Sprintf("digest: %s", l.DigestLvl), + fmt.Sprintf("sync: %s", l.SyncLvl), + fmt.Sprintf("network: %s", l.NetworkLvl), + fmt.Sprintf("rpc: %s", l.RPCLvl), + fmt.Sprintf("state: %s", l.StateLvl), + fmt.Sprintf("runtime: %s", l.RuntimeLvl), + fmt.Sprintf("block producer: %s", l.BlockProducerLvl), + fmt.Sprintf("finality gadget: %s", l.FinalityGadgetLvl), + } + return strings.Join(entries, ", ") +} + // InitConfig is the configuration for the node initialization type InitConfig struct { Genesis string