mirror of
https://github.com/jahruz67/wisp-open.git
synced 2026-08-08 18:14:08 +00:00
fix: restore Info logging functionality and enhance console output for error messages
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user