Overwrite the default error field name
gastonqiu opened this issue · comments
gaston chiu commented
When using logger.WithError(err).Errorln("error!!!")
print error out will generate the structure log message {"error": "something wrong", "msg": "error!!!"}
. I would want to replace the default error name with other name, however, error is not in the FieldKeyMsg.
logInstance.SetFormatter(&logrus.JSONFormatter{
FieldMap: logrus.FieldMap{
logrus.FieldKeyMsg: "@msg",
logrus.FieldKeyTime: "@time",
logrus.FieldKeyLevel: "@level",
},
})
github-actions commented
This issue is stale because it has been open for 30 days with no activity.
github-actions commented
This issue was closed because it has been inactive for 14 days since being marked as stale.