Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added config option for log level #57

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/prefixcollector/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020 Doc.ai and/or its affiliates.
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -37,6 +37,7 @@ type Config struct {
NSMConfigMapName string `default:"nsm-config" desc:"Name of nsm config map" split_words:"true"`
OutputFilePath string `default:"/var/lib/networkservicemesh/config/excluded_prefixes.yaml" desc:"Path of output prefixes file" split_words:"true"`
PrefixesOutputType string `default:"file" desc:"Where to write excluded prefixes" split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
}

// Validate - validates config. Checks PrefixesOutputType and every CIDR from config.ExcludedPrefixes.
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/networkservicemesh/sdk-k8s/pkg/k8s"

"github.com/kelseyhightower/envconfig"
"github.com/sirupsen/logrus"
"k8s.io/client-go/kubernetes"

"github.com/networkservicemesh/sdk/pkg/tools/jaeger"
Expand Down Expand Up @@ -70,6 +71,12 @@ func main() {
span.Logger().Fatalf("Error validating Config from env: %v", err)
}

level, err := logrus.ParseLevel(config.LogLevel)
if err != nil {
logrus.Fatalf("invalid log level %s", config.LogLevel)
}
logrus.SetLevel(level)

span.Logger().Info("Building Kubernetes clientSet...")
clientSetConfig, err := k8s.NewClientSetConfig()
if err != nil {
Expand Down