Skip to content

Commit 98a6400

Browse files
committed
feat(notifications): add
1 parent 2de13e3 commit 98a6400

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

log/log.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package log
33
import (
44
"fmt"
55
"log"
6+
"os"
67
"path/filepath"
78
"runtime"
89
"time"
@@ -149,9 +150,9 @@ func (li *MetaInfo) log() {
149150
nowStr := time.Now().Format(timeFormat)
150151
switch li.Lvl {
151152
case PanicLvl:
152-
log.Panic(li.Msg)
153+
log.Printf("%s%s %s %s%s", red, nowStr, "[PANIC]", li.Msg, reset)
153154
case FatalLvl:
154-
log.Fatal(li.Msg)
155+
log.Printf("%s%s %s %s%s", red, nowStr, "[FATAL]", li.Msg, reset)
155156
case ErrorLvl:
156157
log.Printf("%s%s %s %s%s", red, nowStr, "[ERROR]", li.Msg, reset)
157158
case WarnLvl:
@@ -176,4 +177,10 @@ func exec(li MetaInfo) {
176177
log.Printf("%s%s %s %v%s", red, nowStr, "[ERROR]", err, reset)
177178
}
178179
}
180+
switch li.Lvl {
181+
case PanicLvl:
182+
panic(li.Msg)
183+
case FatalLvl:
184+
os.Exit(1)
185+
}
179186
}

0 commit comments

Comments
 (0)