Skip to content

Document logfile format #7

Open
@techieshark

Description

@techieshark

After a few failed attempts of opening a log file, and digging into the tests and source, it looks like this is the logfile format expected by default:

{ "timestamp": "2018-09-12T05:41:37.562Z", "level": "debug", "message": "message 1", "data": "some data", "another": { "any": "thing" }}
{ "timestamp": "2018-09-12T05:41:36.566Z", "level": "info", "message": "message 2", "data": "some other data" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "warn", "message": "message 3" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "error", "message": "message 4" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "error", "message": "message 5" }

Notes:

  • Each JSON object is a single line. Pretty printed JS objects won't work.
  • levels are "debug" | "info" | "warn" | "error" (capitalization matters)
  • objects should have fields "timestamp", "level", and "message". Any extra fields (e.g. "data" and "another" above) are included in the popup when hitting <enter> on the corresponding line in the main screen.

After fixing for the above, it's working: (except the {orange-fg} issue but that's reported elsewhere (#5)).

main screen:
image

detail screen:
image

Another potential improvement would be better error detection and reporting. I copied the example config file to my home directory and subsequently forgot about it, then when I went to open a file formatted differently than the configuration specified, the output had "undefined" printed where the timestamp should have been.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions