question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could we format logs better?

See original GitHub issue

Currently (working with 0.9.7), if I open Docker container logs in a text reader I see something like

GET /account/customer?restype=container&comp=list 200 19.399 ms - 255

Escape chars are so annoying 😦 Could we turn them off?

Also, would be really helpful to print timestamp in some way, e.g. HH:mm:ss.SSS

Thanks a lot!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
pmanlukascommented, Aug 20, 2018

I will start implementing this change in this week

1reaction
edwin-hubercommented, Jun 11, 2018

Thanks. I’ll mark this as a good first issue and hopefully somebody can get around to looking at it soon.

We use morgan middleware for the logging, which is documented here: https://github.com/expressjs/morgan

to give you the date and unformatted version like you are asking for, one would need to usesomething like:

if (!env.silent) {
    app.use(morgan(':date[iso] :method :url :status :res[content-length] - :response-time ms'));
} 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Log Formatting: 7 Best Practices for Readable Log Files | Scalyr
You might argue that a log file should be machine-readable. I whole-heartedly agree with that. Having machine-readable logs enables you to use ...
Read more >
What is the best practice for formatting logs? - Stack Overflow
8 Answers 8 · Choosing good internal format of logging. I prefer space delimeted since it works nice with Unix text tools and...
Read more >
Tip: Use a Human-Readable Logging Format - Reflectoring
A guide to create a logging format that can be scanned at a single ... Now, we humans are extraordinarily good at recognizing...
Read more >
Why JSON is the Best Application Log Format - Loggly
The biggest benefit of logging in JSON is that it's a structured data format. This makes it possible for you to analyze your...
Read more >
Log Formats – a (Mostly) Complete Guide - Graylog
If you want more info on how to ship your JSON logs to Graylog and parse them off in a clean and understandable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found