From 8c75cb1dad6b238643ba4be0b9ab87adfc0a2897 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 28 Sep 2022 12:03:14 +0300 Subject: [PATCH] [#1770] node: Validate logger config section Signed-off-by: Pavel Karpy --- cmd/neofs-node/validate.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/neofs-node/validate.go b/cmd/neofs-node/validate.go index 6a0640f9..1ac51ab5 100644 --- a/cmd/neofs-node/validate.go +++ b/cmd/neofs-node/validate.go @@ -7,13 +7,26 @@ import ( "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine" shardconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard" + loggerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/logger" treeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/tree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" + "github.com/nspcc-dev/neofs-node/pkg/util/logger" ) // validateConfig validates storage node configuration. func validateConfig(c *config.Config) error { + // logger configuration validation + + var loggerPrm logger.Prm + + err := loggerPrm.SetLevelString(loggerconfig.Level(c)) + if err != nil { + return fmt.Errorf("invalid logger level: %w", err) + } + + // shard configuration validation + shardNum := 0 paths := make(map[string]pathDescription) return engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error {