mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
log: Add a symbol for Fatal log entries
Currently there is no symbol for Fatal-level log entries, so they appear with "-2", which is distracting. This patch makes the Fatal log entries have their own symbol, ☠.
This commit is contained in:
@@ -44,12 +44,14 @@ var (
|
|||||||
type Level int
|
type Level int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Fatal = Level(-2)
|
||||||
Error = Level(-1)
|
Error = Level(-1)
|
||||||
Info = Level(0)
|
Info = Level(0)
|
||||||
Debug = Level(1)
|
Debug = Level(1)
|
||||||
)
|
)
|
||||||
|
|
||||||
var levelToLetter = map[Level]string{
|
var levelToLetter = map[Level]string{
|
||||||
|
Fatal: "☠",
|
||||||
Error: "E",
|
Error: "E",
|
||||||
Info: "_",
|
Info: "_",
|
||||||
Debug: ".",
|
Debug: ".",
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ func testLogger(t *testing.T, fname string, l *Logger) {
|
|||||||
checkContentsMatch(t, "log", fname,
|
checkContentsMatch(t, "log", fname,
|
||||||
`^_ log_test.go:.... log info 1\n`)
|
`^_ log_test.go:.... log info 1\n`)
|
||||||
|
|
||||||
|
os.Truncate(fname, 0)
|
||||||
|
l.Level = Info
|
||||||
|
l.Log(Fatal, 0, "log fatal %d", 1)
|
||||||
|
checkContentsMatch(t, "log", fname,
|
||||||
|
`^☠ log_test.go:.... log fatal 1\n`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBasic(t *testing.T) {
|
func TestBasic(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user