mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
Logger: avoid panic when time is a string (not fmt.Stringer) (#44497)
This commit is contained in:
parent
8a7b469679
commit
3c334cd8ba
@ -91,12 +91,24 @@ func getRecord(keyvals ...interface{}) *record {
|
||||
k, v := keyvals[i], keyvals[i+1]
|
||||
|
||||
if k == "t" {
|
||||
t := v.(fmt.Stringer)
|
||||
time, err := time.Parse("2006-01-02T15:04:05.999999999-0700", t.String())
|
||||
if err == nil {
|
||||
r.time = time
|
||||
t, ok := v.(fmt.Stringer)
|
||||
if ok {
|
||||
time, err := time.Parse("2006-01-02T15:04:05.999999999-0700", t.String())
|
||||
if err == nil {
|
||||
r.time = time
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
t3, ok := v.(string)
|
||||
if ok {
|
||||
// from alerting: 2022-01-26T12:03:41.655107858-08:00
|
||||
time, err := time.Parse("2006-01-02T15:04:05.999999999-07:00", t3)
|
||||
if err == nil {
|
||||
r.time = time
|
||||
continue
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if keyvals[i] == "msg" {
|
||||
|
Loading…
Reference in New Issue
Block a user