mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
simplify logger time and avoid possible crashes (#13986)
time.Format() is not necessary prematurely for JSON marshalling, since JSON marshalling indeed defaults to RFC3339Nano. This also ensures the 'time' is remembered until its logged and it is the same time when the 'caller' invoked 'log' functions.
This commit is contained in:
@@ -80,7 +80,7 @@ func (f fatalMsg) json(msg string, args ...interface{}) {
|
||||
logJSON, err := json.Marshal(&log.Entry{
|
||||
Level: FatalLvl.String(),
|
||||
Message: message,
|
||||
Time: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
Time: time.Now().UTC(),
|
||||
Trace: &log.Trace{Message: message, Source: []string{getSource(6)}},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -159,7 +159,7 @@ func (i infoMsg) json(msg string, args ...interface{}) {
|
||||
logJSON, err := json.Marshal(&log.Entry{
|
||||
Level: InformationLvl.String(),
|
||||
Message: message,
|
||||
Time: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
Time: time.Now().UTC(),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -192,7 +192,7 @@ func (i errorMsg) json(msg string, args ...interface{}) {
|
||||
logJSON, err := json.Marshal(&log.Entry{
|
||||
Level: ErrorLvl.String(),
|
||||
Message: message,
|
||||
Time: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
Time: time.Now().UTC(),
|
||||
Trace: &log.Trace{Message: message, Source: []string{getSource(6)}},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user