Skip to content

Commit

Permalink
porting logging base implementation to SUSE/telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
gbuenodevsuse committed Jul 9, 2024
1 parent 819d8db commit 86b37a4
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 5 deletions.
11 changes: 7 additions & 4 deletions examples/config/telemetry.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

telemetry_base_url: "http://localhost:9999/telemetry"
enabled: true
customer_id: 1234567890
Expand All @@ -9,8 +8,12 @@ datastores:
extras:
some: thing
else:
- one
- two
- three
- one
- two
- three
or:
maybe: 2024
logging:
level: info
location: stderr
style: text
12 changes: 12 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"encoding/json"
"fmt"
"log"
"log/slog"
Expand Down Expand Up @@ -39,6 +40,17 @@ type DBConfig struct {
Params string `yaml:"params"`
}

type LogConfig struct {
Level string `yaml:"level" json:"level"`
Location string `yaml:"location" json:"location"`
Style string `yaml:"style" json:"style"`
}

func (lc *LogConfig) String() string {
str, _ := json.Marshal(lc)
return string(str)
}

func NewConfig(cfgFile string) (*Config, error) {

//Default configuration
Expand Down
Loading

0 comments on commit 86b37a4

Please sign in to comment.