hedhyw / json-log-viewer

Interactive viewer for JSON logs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customizable columns support

denisvmedia opened this issue · comments

Currently we can see Time/Level/Message. Do you think we can make it customizable? The default config would be as follows:

[
    {
        "title": "Time",
        "ref": ".time"
    },
    {
        "title": "Level",
        "ref": ".level"
    },
    {
        "title": "Message",
        "ref": ".msg"
    }
]

Custom config:

[
    {
        "title": "Time",
        "ref": ".time"
    },
    {
        "title": "Level",
        "ref": ".level"
    },
    {
        "title": "Custom Field",
        "ref": ".meta.customField"
    },
    {
        "title": "Message",
        "ref": ".msg"
    }
]

WDYT?

P.S. I really like your viewer. It's simple, but so much usable in my case.

Hi, it is a good idea.

Config (by priority):

  • $PWD/.json-log-config.json
  • $HOME/.json-log-config.json
  • Default values.

And make the format a little more customizable (ref is a slice and kind for colorizing and for additional processing):

{
    "fields": [
        {
            "title": "Time",
            "ref": [".time", ".ts"],
            "kind": "time"
        },
        {
            "title": "Level",
            "ref": [".level"],
            "kind": "level"
        },
        {
            "title": "Custom Field",
            "ref": [".meta.customField"],
            "kind": "any"
        },
        {
            "title": "Message",
            "ref": [".msg", ".err", ".error"],
            "kind": "message"
        }
    ]
}

Yeah, I like it. Just maybe not sure how multiple values of ref are meant to be processed.

P.S. I'd maybe rename the config to just .jlv.json for simplicity. I feel your tool has a potential and deserves a good short name :)