From c42c103ddb66028a085fb452102f73f8b27dcdcb Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Mon, 1 Jun 2026 09:26:50 -0700 Subject: Improve startup logging and logging consistency Startup log: - Add interface, port, and fileTransferPort fields to the "Hotline server started" line so operators can see what the server bound to. - Resolve an empty -interface flag to 0.0.0.0 for display. Levels: - Demote the two Redis startup messages (ban management, cleared online users) from Info to Debug. Consistency: - Standardize the error field key to "err" (was "Err" in a few account handlers) and lowercase "Account" -> "account". - Standardize the remote-address key to "remoteAddr" (was "RemoteAddr"). - Replace fmt.Sprintf in the tracker-registration message and string concatenation in the config-dir-init and ban-disconnect messages with structured fields; use the standard "err" key. - Give the two bare rLogger.Error(err.Error()) file-transfer calls a descriptive message and an "err" field. logger.go: - Only attach the rotating lumberjack file writer when --log-file is set. An empty Filename made lumberjack write to a temp file by default. --- cmd/mobius-hotline-server/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index 8b9d54c..dced2c5 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -71,7 +71,7 @@ func main() { slogger.Error("Error copying config dir", "err", err) os.Exit(1) } - slogger.Info("Config dir initialized at " + *configDir) + slogger.Info("Config dir initialized", "config", *configDir) } else { slogger.Info("Existing config dir found. Skipping initialization.") } @@ -131,7 +131,7 @@ func main() { srv.Redis = redisClient srv.BanList = mobius.NewRedisBanMgr(redisClient, slogger) - slogger.Info("Using Redis for ban management", "addr", *redisAddr) + slogger.Debug("Using Redis for ban management", "addr", *redisAddr) } else { srv.BanList, err = mobius.NewBanFile(path.Join(*configDir, "Banlist.yaml")) if err != nil { @@ -215,7 +215,11 @@ func main() { } }() - slogger.Info("Hotline server started", "version", version, "config", *configDir) + boundInterface := *netInterface + if boundInterface == "" { + boundInterface = "0.0.0.0" + } + slogger.Info("Hotline server started", "version", version, "config", *configDir, "interface", boundInterface, "port", *basePort, "fileTransferPort", *basePort+1) if tlsConfig != nil { slogger.Info("TLS enabled", "port", *tlsPort, "fileTransferPort", *tlsPort+1) } -- cgit