mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
32 lines
506 B
Go
32 lines
506 B
Go
package logger
|
|
|
|
import "strings"
|
|
|
|
var (
|
|
fieldTs = "ts"
|
|
fieldLevel = "level"
|
|
fieldCaller = "caller"
|
|
fieldMsg = "msg"
|
|
)
|
|
|
|
func setLoggerJSONFields() {
|
|
fields := strings.Split(*loggerJSONFields, ",")
|
|
for _, f := range fields {
|
|
v := strings.Split(strings.TrimSpace(f), ":")
|
|
if len(v) != 2 {
|
|
continue
|
|
}
|
|
|
|
old, new := v[0], v[1]
|
|
switch old {
|
|
case "ts":
|
|
fieldTs = new
|
|
case "level":
|
|
fieldLevel = new
|
|
case "caller":
|
|
fieldCaller = new
|
|
case "msg":
|
|
fieldMsg = new
|
|
}
|
|
}
|
|
}
|