rs / zerolog

Zero Allocation JSON Logger
MIT License
10.39k stars 566 forks source link

Add FormatPrepare to ConsoleWriter #595

Closed mitar closed 11 months ago

mitar commented 11 months ago

I realized that most of the recent additions like PartsExclude and FieldsExclude could be done just be some preprocessing before formatting starts.

In my particular case, I realized that I cannot use FormatMessage because it has access only to the message and not other fields: but I want to make it bold only if the level is info or above.

So FormatPrepare allows all such changes: removing fields, adding fields, changing fields.