Skip to content

Commit ff7156f

Browse files
committed
added log level to server config
1 parent 00787d6 commit ff7156f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

charts/speakerbob/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ tolerations: []
6363
affinity: {}
6464

6565
configuration:
66+
log_level: info
6667
host: 0.0.0.0
6768
port: 80
6869
data_path: /data

cmd/server/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
)
1010

1111
type Configuration struct {
12+
LogLevel string `yaml:"log_level"`
13+
1214
Host string `yaml:"host"`
1315
Port int `yaml:"port"`
1416
DataPath string `yaml:"data_path"`
@@ -23,6 +25,7 @@ type Configuration struct {
2325
}
2426

2527
var DefaultConfiguration = Configuration{
28+
LogLevel: "info",
2629
Host: "0.0.0.0",
2730
Port: 80,
2831
DataPath: "/etc/speakerbob/data",

cmd/server/server.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ func Server(*cobra.Command, []string) {
3535
logrus.Fatal(err)
3636
}
3737

38+
// set log level
39+
level, err := logrus.ParseLevel(config.LogLevel)
40+
if err != nil {
41+
logrus.Fatal(err)
42+
}
43+
logrus.SetLevel(level)
44+
3845
// setup the store
3946
badgerdbOptions := badger.DefaultOptions(config.DataPath)
4047
badgerdbOptions.Logger = logrus.StandardLogger()

0 commit comments

Comments
 (0)