about summary refs log tree commit diff stats
path: root/serve/main.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-09 18:24:58 +0200
committerAlan Pearce2024-05-09 19:27:57 +0200
commit99d5507b223baa6c780707d32c7bbbb8611034f0 (patch)
treeb982d873e7bd58ef9ad9544074d4475b5de27dfb /serve/main.go
parent14c1ddaf7c5468c5966b0c1585f19a5ff39c206d (diff)
downloadsearchix-99d5507b223baa6c780707d32c7bbbb8611034f0.tar.lz
searchix-99d5507b223baa6c780707d32c7bbbb8611034f0.tar.zst
searchix-99d5507b223baa6c780707d32c7bbbb8611034f0.zip
feat: allow configuration of log level
Diffstat (limited to 'serve/main.go')
-rw-r--r--serve/main.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/serve/main.go b/serve/main.go
index 6b55977..9378de1 100644
--- a/serve/main.go
+++ b/serve/main.go
@@ -20,12 +20,6 @@ var (
 )
 
 func main() {
-	if os.Getenv("DEBUG") != "" {
-		slog.SetLogLoggerLevel(slog.LevelDebug)
-	}
-	log.SetFlags(log.LstdFlags | log.Lmsgprefix)
-	log.SetPrefix("searchix: ")
-
 	runtimeConfig := server.Config{}
 	help, err := conf.Parse("", &runtimeConfig)
 	if err != nil {
@@ -35,6 +29,9 @@ func main() {
 		}
 		log.Panicf("parsing runtime configuration: %v", err)
 	}
+	slog.SetLogLoggerLevel(runtimeConfig.LogLevel)
+	log.SetFlags(log.LstdFlags | log.Lmsgprefix)
+	log.SetPrefix("searchix: ")
 
 	c := make(chan os.Signal, 2)
 	signal.Notify(c, os.Interrupt)