Skip to content

Commit

Permalink
feat(notifications): add
Browse files Browse the repository at this point in the history
  • Loading branch information
ArielHAlba committed Aug 18, 2022
1 parent 2de13e3 commit 98a6400
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package log
import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"time"
Expand Down Expand Up @@ -149,9 +150,9 @@ func (li *MetaInfo) log() {
nowStr := time.Now().Format(timeFormat)
switch li.Lvl {
case PanicLvl:
log.Panic(li.Msg)
log.Printf("%s%s %s %s%s", red, nowStr, "[PANIC]", li.Msg, reset)
case FatalLvl:
log.Fatal(li.Msg)
log.Printf("%s%s %s %s%s", red, nowStr, "[FATAL]", li.Msg, reset)
case ErrorLvl:
log.Printf("%s%s %s %s%s", red, nowStr, "[ERROR]", li.Msg, reset)
case WarnLvl:
Expand All @@ -176,4 +177,10 @@ func exec(li MetaInfo) {
log.Printf("%s%s %s %v%s", red, nowStr, "[ERROR]", err, reset)
}
}
switch li.Lvl {
case PanicLvl:
panic(li.Msg)
case FatalLvl:
os.Exit(1)
}
}

0 comments on commit 98a6400

Please sign in to comment.