Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document logfile format #7

Open
techieshark opened this issue Sep 12, 2018 · 1 comment
Open

Document logfile format #7

techieshark opened this issue Sep 12, 2018 · 1 comment

Comments

@techieshark
Copy link
Contributor

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.

@3v1n0
Copy link

3v1n0 commented Oct 20, 2020

Agree with this, it took me a while to get it and read the code.

Also would be nice to support pure JSON object files (I've logs that are just an array of objects... It would be easy to get them working, maybe using a command line flag for them).

Together with #16, where figuring out if it's just a numeric value should be enough to try to use Date to convert to the locale string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants