loguru icon indicating copy to clipboard operation
loguru copied to clipboard

Custom serializer

Open sripathivenky opened this issue 2 years ago • 2 comments

  • adding serializer that allows users to pass a method to work in hand with serialize flag.

sripathivenky avatar Oct 14 '21 06:10 sripathivenky

@Delgan

sripathivenky avatar Oct 14 '21 15:10 sripathivenky

Hi @sripathivenky.

Sorry for being late to answer and thanks for taking of your time to improve Loguru.

The idea to add a new serializer parameter has been discussed several times (https://github.com/Delgan/loguru/issues/372#issuecomment-736774742, https://github.com/Delgan/loguru/issues/339#issuecomment-702013972, https://github.com/Delgan/loguru/issues/278#issuecomment-639519441, https://github.com/Delgan/loguru/issues/203#issuecomment-575684228). I'm reticent to do so because I'm not fan of such optional parameter while there already exists solutions which provide the same result: Serializing log messages using a custom function.

Using a custom sink, formatter or even patch() allow anyone to customize the serialization without much efforts.

I understand that a serializer option would make it more straightforward but it also adds some complexity I prefer to avoid.

Delgan avatar Dec 05 '21 11:12 Delgan