Closed navin772 closed 1 month ago
This sounds good to me. Though users can use external tools like jq for beautifying but having the ability to do so in karmor itself might come in handy if user doesn't have the tools present.
IMO We can keep the default output as non-beautified and have a --beautify
flag which will pretty-print the JSON.
cc @daemon1024 @kranurag7
Agree with Rudraksh here, We also ingest these logs to some logging solutions which will prefer the default that we have now.
For flag I think we can go for something like --format
and --output
with value of jsonindent
or similar something. With this, we can support multiple values in future if required like yaml, table etc. that we have with other CLIs.
So, the final command will look something like karmor logs --output jsonindent
replacing the --json
flag completely?
This will require a docs update as --json
flag is used widely. Thoughts?
Don't remove --json
that would be a breaking change and we should avoid that.
Adding another value to the flag would be ideal I think.
Edit: We can discuss more on if jsonindent is the name we prefer because it doesn't sound intuitive in my head.
Yes... let's keep the current output and also the --json
flag. We can add an --output
/-o
flag:
--output json
- plain json
--output pretty-json
- beautified json
--output text
- usual text output
This looks good, so the final commands will look something like:
karmor logs --output json
karmor logs --output pretty-json
karmor logs --output text
The --json
flag will still be present:
karmor logs --json
And the normal log output:
karmor logs
Right?
Hi, @navin772 ! Can I work on this enhancement?
Currently
karmor logs --json
gives a cluttered output in a single line:By using
MarshalIndent
instead ofMarshal
we can get beautified output like this:Let me know if this is required, I will create a PR for the same.