sirupsen / logrus

Structured, pluggable logging for Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overwrite the default error field name

gastonqiu opened this issue · comments

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",
},
})

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

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