sirupsen / logrus

Structured, pluggable logging for Go.
MIT License
24.8k stars 2.27k forks source link

Overwrite the default error field name #1316

Closed gastonqiu closed 2 years ago

gastonqiu commented 2 years ago

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[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 14 days since being marked as stale.