From df3a641f5f9088d9f61fd3cd2399e062601bdfe1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 14:14:21 +0100 Subject: [PATCH] ax(logging): replace prose comments with usage examples on global functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle 2 — global convenience functions had comments restating the signature ("logs a debug message using the global logger") rather than showing concrete calls with realistic values. Co-Authored-By: Charon --- pkg/logging/logger.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/logging/logger.go b/pkg/logging/logger.go index 4c4d671..f3e8f7b 100644 --- a/pkg/logging/logger.go +++ b/pkg/logging/logger.go @@ -228,42 +228,42 @@ func SetGlobalLevel(level Level) { // Global convenience functions that use the global logger -// Debug logs a debug message using the global logger. +// logging.Debug("hashrate collected", logging.Fields{"rate": 1234, "miner": "xmrig"}) func Debug(msg string, fields ...Fields) { GetGlobal().Debug(msg, fields...) } -// Info logs an informational message using the global logger. +// logging.Info("miner started", logging.Fields{"miner": "xmrig", "pool": "pool.lthn.io"}) func Info(msg string, fields ...Fields) { GetGlobal().Info(msg, fields...) } -// Warn logs a warning message using the global logger. +// logging.Warn("hashrate dropped below threshold", logging.Fields{"current": 500, "min": 1000}) func Warn(msg string, fields ...Fields) { GetGlobal().Warn(msg, fields...) } -// Error logs an error message using the global logger. +// logging.Error("miner process exited unexpectedly", logging.Fields{"code": -1}) func Error(msg string, fields ...Fields) { GetGlobal().Error(msg, fields...) } -// Debugf logs a formatted debug message using the global logger. +// logging.Debugf("collected %d hashrate points for %s", len(points), minerName) func Debugf(format string, args ...interface{}) { GetGlobal().Debugf(format, args...) } -// Infof logs a formatted informational message using the global logger. +// logging.Infof("miner %s started on pool %s", minerName, poolURL) func Infof(format string, args ...interface{}) { GetGlobal().Infof(format, args...) } -// Warnf logs a formatted warning message using the global logger. +// logging.Warnf("hashrate %d H/s below minimum %d H/s", current, minimum) func Warnf(format string, args ...interface{}) { GetGlobal().Warnf(format, args...) } -// Errorf logs a formatted error message using the global logger. +// logging.Errorf("failed to connect to pool %s: %v", poolURL, err) func Errorf(format string, args ...interface{}) { GetGlobal().Errorf(format, args...) }