package main import ( "context" "flag" "log/slog" "os" "os/signal" "syscall" "code.ndumas.com/ndumas/muddy/core" "code.ndumas.com/ndumas/muddy/systems" ) func main() { var ( level string ) flag.StringVar(&level, "level", "INFO", "Log level: INFO/info, DEBUG/debug, or ERROR/error") flag.Parse() app := core.New(level) rs := &systems.RoomSystem{ Rooms: make(map[uint64]*systems.Room, 0), L: app.L.With(slog.String("system", "room")), } app.W.AddSystem(rs) app.L.With( slog.Int("room count", len(rs.Rooms)), ).Info("setup complete") ctx, cancel := context.WithCancel(context.Background()) c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c cancel() }() app.Run(ctx) }