mowispace/react-native-logs

Open to adding custom formatting support?

chmac opened this issue · 2 comments

chmac commented

I see the option to provide a customer serialiser. Would you be open to adding support for custom formatters as well?

My use case is that we want to log jsonlines so each output from the log needs to be valid JSON. Currently we get some fields at the front, and then a concatenation of JSON.stringify() output. Writing a custom stringify function has no access to the level, the date, and so on.

It seems like it would be fairly simple to make _formatMsg a pluggable function. I'd be happy to have a go at submitting a PR. But I wanted to check in before starting on any code to see if you're open to the idea.

As always, thanks for this package, it's a real help.

chmac commented

It seemed like implementing this would be the fastest option to solve our current challenge, so I've done that. You can see the approach in my PR #79.

The pr is now merged