logging
This commit is contained in:
1 parent
65326b0ff5
commit
2900582eb4
5 files changed
+24
-12
No files matched your search
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -67,18 +66,13 @@ func (l *Logger) print(level Level, message string, properties map[string]string
|
||||
Time string `json:"time"`
|
||||
Message string `json:"message"`
|
||||
Properties map[string]string `json:"properties,omitempty"`
|
||||
Trace string `json:"trace,omitempty"`
|
||||
}{
|
||||
Level: level.String(),
|
||||
Time: time.Now().UTC().Format(time.RFC3339),
|
||||
Message: message,
|
||||
Level: level.String(),
|
||||
Time: time.Now().UTC().Format(time.RFC3339),
|
||||
Message: message,
|
||||
Properties: properties,
|
||||
}
|
||||
|
||||
if level >= LevelError {
|
||||
aux.Trace = string(debug.Stack())
|
||||
}
|
||||
|
||||
var line []byte
|
||||
|
||||
line, err := json.Marshal(aux)
|
||||
|
||||
Reference in new issue
Block a user