fix: restore Info logging functionality and enhance console output for error messages

This commit is contained in:
jahruz67
2026-05-19 18:03:48 -07:00
parent 00f4912cc3
commit fb555ea533
+9 -3
View File
@@ -67,9 +67,8 @@ func Close() {
}
// Info logs an informational message with timestamp.
// Modified to do nothing so only errors are logged.
func Info(format string, args ...interface{}) {
// Do nothing
log("INFO", format, args...)
}
// Error logs an error message with timestamp.
@@ -77,7 +76,7 @@ func Error(format string, args ...interface{}) {
log("ERROR", format, args...)
}
// log writes a formatted log message to the log file.
// log writes a formatted log message to the log file and console.
func log(level, format string, args ...interface{}) {
logMutex.Lock()
defer logMutex.Unlock()
@@ -95,6 +94,13 @@ func log(level, format string, args ...interface{}) {
message := fmt.Sprintf(format, args...)
logLine := fmt.Sprintf("[%s] %s: %s\n", timestamp, level, message)
// Print to console for real-time terminal output
if level == "ERROR" {
fmt.Fprint(os.Stderr, logLine)
} else {
fmt.Fprint(os.Stdout, logLine)
}
if logFile != nil {
logFile.WriteString(logLine)
logFile.Sync()