json-log-viewer icon indicating copy to clipboard operation
json-log-viewer copied to clipboard

feat: Multiple configurations

Open RayPS opened this issue 1 year ago • 1 comments

If I understand correctly, only a single configuration file can be stored in $PWD or $HOME currently. The only way to maintain and use different configurations is to store them separately in different directory and switch them by changing PWD. Not to mention having a different configuration in the same directory.

I hope there is an option to let us specify the path of configuration file and always having the higher priority than $PWD and $HOME. So in concept:

jlv access-log.json --conf view2.jlv.jsonc

Or maybe having a different configuration in a single file? In case of not breaking current format:

{
    fields: [], // default
    another_fields: [],
    different_fields: [],
    more_fields: [],
    blahblah: []
}

RayPS avatar Apr 07 '24 20:04 RayPS

Hello, thanks for the feature request!

It's a good idea with a config flag!

  • jlv -c custom_config.json app.log
  • jlv --config custom_config.json app.log

We can pass it to https://github.com/hedhyw/json-log-viewer/blob/d1b9829422eb783b62e405061ea73423b61086b5/cmd/jlv/main.go#L41

hedhyw avatar Apr 08 '24 07:04 hedhyw