fix: resolve duplicate logging functions
- Remove duplicate Error and Fatal function definitions - Fix missing closing brace in Fatal function - Clean up duplicate history tracking code - Ensure proper function closure and syntax
This commit is contained in:
parent
d6e1b14e7d
commit
58f54ddb79
|
|
@ -181,7 +181,20 @@ func Fatal(cat Category, format string, args ...interface{}) {
|
||||||
logger.Printf("%s %s", timestamp, msg)
|
logger.Printf("%s %s", timestamp, msg)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
history = append(history, fmt.Sprintf("%s %s", timestamp, msg))
|
|
||||||
|
// Fatal logs a fatal error and exits (always logged, even when debug is off)
|
||||||
|
func Fatal(cat Category, format string, args ...interface{}) {
|
||||||
|
msg := fmt.Sprintf("%s FATAL: %s", cat, fmt.Sprintf(format, args...))
|
||||||
|
timestamp := time.Now().Format(time.RFC3339Nano)
|
||||||
|
if file != nil {
|
||||||
|
fmt.Fprintf(file, "%s %s\n", timestamp, msg)
|
||||||
|
file.Sync()
|
||||||
|
}
|
||||||
|
logger.Printf("%s %s", timestamp, msg)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: history tracking is disabled during fatal exit to avoid infinite loops
|
||||||
if len(history) > historyMax {
|
if len(history) > historyMax {
|
||||||
history = history[len(history)-historyMax:]
|
history = history[len(history)-historyMax:]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user