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. --- hotline/file_transfer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hotline/file_transfer.go') diff --git a/hotline/file_transfer.go b/hotline/file_transfer.go index 98999f1..86e10eb 100644 --- a/hotline/file_transfer.go +++ b/hotline/file_transfer.go @@ -477,7 +477,7 @@ func DownloadFolderHandler(rwc io.ReadWriter, fullPath string, fileTransfer *Fil // Send file size to client if _, err := rwc.Write(hlFile.Ffo.TransferSize(dataOffset)); err != nil { - rLogger.Error(err.Error()) + rLogger.Error("Error sending file size", "err", err) return fmt.Errorf("error sending file size: %w", err) } @@ -625,7 +625,7 @@ func UploadFolderHandler(rwc io.ReadWriter, fullPath string, fileTransfer *FileT } if err := receiveFile(rwc, file, io.Discard, io.Discard, fileTransfer.bytesSentCounter); err != nil { - rLogger.Error(err.Error()) + rLogger.Error("Error receiving file", "err", err) } err = os.Rename(fullPath+"/"+fu.FormattedPath()+".incomplete", fullPath+"/"+fu.FormattedPath()) -- cgit