aboutsummaryrefslogtreecommitdiff
path: root/go/client
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-18 15:58:37 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:39 +0200
commit9884eca784e853e48ff82ecd904890d28b2fe0fa (patch)
treeda7ce36527d68d48d974149cbd3214285b39ce35 /go/client
parent408a1d0ec8f22623769eba7f7923d6268ba834ca (diff)
downloadmuhqs-game-9884eca784e853e48ff82ecd904890d28b2fe0fa.tar.gz
muhqs-game-9884eca784e853e48ff82ecd904890d28b2fe0fa.zip
allow game log to be configured using command line flags
Diffstat (limited to 'go/client')
-rw-r--r--go/client/main.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/go/client/main.go b/go/client/main.go
index b631269e..2d936d55 100644
--- a/go/client/main.go
+++ b/go/client/main.go
@@ -3,13 +3,15 @@ package main
import (
"flag"
"io"
- "log"
+ "log/slog"
"os"
+ "strings"
"github.com/hajimehoshi/ebiten/v2"
"muhq.space/muhqs-game/go/activities"
"muhq.space/muhqs-game/go/font"
+ "muhq.space/muhqs-game/go/log"
)
const (
@@ -50,8 +52,19 @@ func main() {
flag.StringVar(&startMenu.mapPath, "map", "the-kraken", "the map to load")
flag.StringVar(&startMenu.remote, "remote", "", "address of remote game to connect to")
+
+ logLevel := flag.Int("logLevel", int(slog.LevelInfo.Level()), "active log level")
+ loggedFilesVar := flag.String("loggedFiles", "", "files to log")
flag.Parse()
+ if *logLevel != int(slog.LevelInfo.Level()) || *loggedFilesVar != "" {
+ loggedFiles := strings.Split(*loggedFilesVar, " ")
+ log.Configure(loggedFiles, &slog.HandlerOptions{
+ AddSource: true,
+ Level: slog.Level(*logLevel),
+ })
+ }
+
ebiten.SetWindowSize(app.windowWidth, app.windowHeight)
ebiten.SetWindowTitle("Muhq's Game")