You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to log accodingly to field in the log, like this: log.WithFields(log.Fields{"Field": "logname"}).Info("My log message!")
So all logs that contains that field would go to logname.log, if I have: log.WithFields(log.Fields{"Field": "logname2"}).Info("My log message!")
It would go to logname2.log
How can I achieve that ?
The text was updated successfully, but these errors were encountered:
Hm... An interesting usecase. Not one I'd considered going into this.
Currently, It's not something that can be done. I set it up to be an exact mapping between entry.Level and a file, then later streams were added. If you want to write a PR you could probably do something similar to the introduction of streams.
If you wanted to add support for file routing by Fields you would need the following:
You'd have to add code to the fileWrite method that would allow using something other than entry.Level as the file selector.
You'd have to add a Field-Filename map that would be set in the contructor. Similar to the PathMap, and if you just create a different type like FieldPathMap then it could be supported without too much difficulty.
I don't see it as a super complex change, but you'd have to be really careful to not introduce regressions.
I would like to log accodingly to field in the log, like this:
log.WithFields(log.Fields{"Field": "logname"}).Info("My log message!")
So all logs that contains that field would go to logname.log, if I have:
log.WithFields(log.Fields{"Field": "logname2"}).Info("My log message!")
It would go to logname2.log
How can I achieve that ?
The text was updated successfully, but these errors were encountered: