Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.
https://nebo15.github.io/logger_json/
MIT License
237 stars 92 forks source link

Pretty print #128

Closed anthonator closed 1 month ago

anthonator commented 2 months ago

A pretty print option would be helpful since JSON logs can be hard to grok visually. I'm currently working on setting up JSON logging and it's been a bit of a pain to try and verify everything.

Jason's formatter does support pretty print so hopefully it wouldn't be too difficult.

I'd be willing to contribute this feature if it's something you're interested in supporting.

AndrewDryga commented 2 months ago

@anthonator I think we can accept encoder_opts in the formatters and pass that to Jason, so that you can set: encoder_opts: [pretty: true].

bvobart commented 1 month ago

I'm using the Elastic formatter and I'm simply piping my application's output through ecslog to get it pretty-printed during development. Usage is as simple as mix run | ecslog

anthonator commented 1 month ago

@AndrewDryga apologies, but are you saying this already exists or would be good to implement? I'm not seeing :encoder_opts in the documentation or code so I'm assuming the former. Is that correct?

AndrewDryga commented 1 month ago

@anthonator I'm sorry - my message was a bit ambiguous, I meant that it would be nice to add it, a PR would be welcome :).

anthonator commented 1 month ago

@AndrewDryga thank you for clarifying!