Skip to content

Commit 504926c

Browse files
committed
fix: logging time
1 parent 300d2a8 commit 504926c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

utils/logger.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import (
1212
"time"
1313
)
1414

15-
var currentTime = time.Now().Format("2006/01/02 15:04:05")
16-
1715
func Info(msg string, args ...any) {
16+
var currentTime = time.Now().Format("2006/01/02 15:04:05")
1817
formattedMessage := fmt.Sprintf(msg, args...)
1918
if len(args) == 0 {
2019
fmt.Printf("%s INFO: %s\n", currentTime, msg)
@@ -25,6 +24,7 @@ func Info(msg string, args ...any) {
2524

2625
// Warn warning message
2726
func Warn(msg string, args ...any) {
27+
var currentTime = time.Now().Format("2006/01/02 15:04:05")
2828
formattedMessage := fmt.Sprintf(msg, args...)
2929
if len(args) == 0 {
3030
fmt.Printf("%s WARN: %s\n", currentTime, msg)
@@ -33,6 +33,7 @@ func Warn(msg string, args ...any) {
3333
}
3434
}
3535
func Error(msg string, args ...any) {
36+
var currentTime = time.Now().Format("2006/01/02 15:04:05")
3637
formattedMessage := fmt.Sprintf(msg, args...)
3738
if len(args) == 0 {
3839
fmt.Printf("%s ERROR: %s\n", currentTime, msg)
@@ -41,6 +42,7 @@ func Error(msg string, args ...any) {
4142
}
4243
}
4344
func Done(msg string, args ...any) {
45+
var currentTime = time.Now().Format("2006/01/02 15:04:05")
4446
formattedMessage := fmt.Sprintf(msg, args...)
4547
if len(args) == 0 {
4648
fmt.Printf("%s INFO: %s\n", currentTime, msg)
@@ -51,6 +53,7 @@ func Done(msg string, args ...any) {
5153

5254
// Fatal logs an error message and exits the program
5355
func Fatal(msg string, args ...any) {
56+
var currentTime = time.Now().Format("2006/01/02 15:04:05")
5457
// Fatal logs an error message and exits the program.
5558
formattedMessage := fmt.Sprintf(msg, args...)
5659
if len(args) == 0 {

0 commit comments

Comments
 (0)