adams85 / filelogger

A lightweight yet feature-rich file logger implementation for the Microsoft.Extensions.Logging framework.
MIT License
147 stars 22 forks source link

Customizable Logging Templates? #18

Closed jemp closed 2 years ago

jemp commented 2 years ago

Hi! Absolutely love the convenience of this library!

I do have a question: Is it possible to customize the Logging Headers that's being outputted to the file (Not the file name)?

Looks like by default it's writing like this:

info: My.Project.Here[0] @ 2021-10-14T00:44:56.8727360-04:00

Is there currently a way to add a custom Date/Time Format, and swap the order of the tags above?

Thanks!

adams85 commented 2 years ago

Hi there!

The log format is fully customizable. You'll need to subclass FileLogEntryTextBuilder and override the appropriate methods. E.g. for customizing the date/time format, override the AppendTimestamp method.

See also https://github.com/adams85/filelogger/issues/13