There are many things, what must be in every entry. For example appname or hostname.
This can be added to Logger or to Formatters. I think modify Formatters is better decision.
I've had similar thoughts, and used this functionality in other loggers (in other languages). I'll look into this once my current PR is merged.
Does passing around a logrus.FieldLogger not satisfy this requirement?
@PurpureGecko Do you have a proposed design? PR?
Actually, this is fairly easily done by passing around a log.Entry populated with the fields:
logger := logrus.WithField("default", "foo")
logger.Info("will have default")
This has been sufficient in a number of applications. You can even store the logger in a context to make it accessible in cross-cutting areas.
Closing this. If this is insufficient, please propose a solution with a PR.
The problem is that with the current implementation you can't add default fields to the standard logger.
Most helpful comment
The problem is that with the current implementation you can't add default fields to the standard logger.