diff --git a/utils/logger.go b/utils/logger.go index cd84a3e..76ce3b2 100644 --- a/utils/logger.go +++ b/utils/logger.go @@ -12,9 +12,8 @@ import ( "time" ) -var currentTime = time.Now().Format("2006/01/02 15:04:05") - func Info(msg string, args ...any) { + var currentTime = time.Now().Format("2006/01/02 15:04:05") formattedMessage := fmt.Sprintf(msg, args...) if len(args) == 0 { fmt.Printf("%s INFO: %s\n", currentTime, msg) @@ -25,6 +24,7 @@ func Info(msg string, args ...any) { // Warn warning message func Warn(msg string, args ...any) { + var currentTime = time.Now().Format("2006/01/02 15:04:05") formattedMessage := fmt.Sprintf(msg, args...) if len(args) == 0 { fmt.Printf("%s WARN: %s\n", currentTime, msg) @@ -33,6 +33,7 @@ func Warn(msg string, args ...any) { } } func Error(msg string, args ...any) { + var currentTime = time.Now().Format("2006/01/02 15:04:05") formattedMessage := fmt.Sprintf(msg, args...) if len(args) == 0 { fmt.Printf("%s ERROR: %s\n", currentTime, msg) @@ -41,6 +42,7 @@ func Error(msg string, args ...any) { } } func Done(msg string, args ...any) { + var currentTime = time.Now().Format("2006/01/02 15:04:05") formattedMessage := fmt.Sprintf(msg, args...) if len(args) == 0 { fmt.Printf("%s INFO: %s\n", currentTime, msg) @@ -51,6 +53,7 @@ func Done(msg string, args ...any) { // Fatal logs an error message and exits the program func Fatal(msg string, args ...any) { + var currentTime = time.Now().Format("2006/01/02 15:04:05") // Fatal logs an error message and exits the program. formattedMessage := fmt.Sprintf(msg, args...) if len(args) == 0 {