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.
|
// Info logs an informational message with timestamp.
|
||||||
// Modified to do nothing so only errors are logged.
|
|
||||||
func Info(format string, args ...interface{}) {
|
func Info(format string, args ...interface{}) {
|
||||||
// Do nothing
|
log("INFO", format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error logs an error message with timestamp.
|
// Error logs an error message with timestamp.
|
||||||
@@ -77,7 +76,7 @@ func Error(format string, args ...interface{}) {
|
|||||||
log("ERROR", format, args...)
|
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{}) {
|
func log(level, format string, args ...interface{}) {
|
||||||
logMutex.Lock()
|
logMutex.Lock()
|
||||||
defer logMutex.Unlock()
|
defer logMutex.Unlock()
|
||||||
@@ -95,6 +94,13 @@ func log(level, format string, args ...interface{}) {
|
|||||||
message := fmt.Sprintf(format, args...)
|
message := fmt.Sprintf(format, args...)
|
||||||
logLine := fmt.Sprintf("[%s] %s: %s\n", timestamp, level, message)
|
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 {
|
if logFile != nil {
|
||||||
logFile.WriteString(logLine)
|
logFile.WriteString(logLine)
|
||||||
logFile.Sync()
|
logFile.Sync()
|
||||||
|
|||||||
Reference in New Issue
Block a user