From 52f77cc186fca45c242f4217daea63dd61904888 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sun, 18 Jun 2023 18:50:34 -0600 Subject: [PATCH] Pass log types to logger on creation --- graph.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graph.go b/graph.go index aa121f2..bc97069 100644 --- a/graph.go +++ b/graph.go @@ -20,10 +20,10 @@ type DefaultLogger struct { init bool init_lock sync.Mutex loggers map[string]zerolog.Logger + components []string } -var log DefaultLogger = DefaultLogger{loggers: map[string]zerolog.Logger{}} -var all_components = []string{"update", "graph", "event", "resource", "manager", "test", "gql", "vex", "gqlws", "gqlws_new", "gqlws_hb", "listeners"} +var log DefaultLogger = DefaultLogger{loggers: map[string]zerolog.Logger{}, components: []string{"update", "graph", "event", "resource", "manager", "test", "gql", "gqlws", "gqlws_new", "gqlws_hb", "listeners"}} func (logger * DefaultLogger) Init(components []string) error { logger.init_lock.Lock() @@ -50,7 +50,7 @@ func (logger * DefaultLogger) Init(components []string) error { } writer := io.MultiWriter(file, os.Stdout) - for _, c := range(all_components) { + for _, c := range(logger.components) { if component_enabled(c) == true { logger.loggers[c] = zerolog.New(writer).With().Timestamp().Str("component", c).Logger() }