Better Programming

Advice for programmers.

Follow publication

Member-only story

A Complete Guide to Node.js Logging

With the best practices for logging

Yasas Sandeepa
Better Programming
Published in
10 min readSep 22, 2021

--

Image with article’s title.
Background by Markus Spiske on Unsplash | Created by the author

If I ask you a question, which JavaScript function is most useful for finding errors, your obvious answer is console.log.

It is pretty easy to detect errors under the development stage either logging or debugging. But when it comes to production, there's much more you should consider about logging as it is critical for monitoring and troubleshooting your application.

This article will guide you to implement a fully flexible logging framework by explaining the core concepts and best practices. Before going into the implementation, let’s start with the basics.

What Is Logging and Why It Is Important?

Logging is the process of recording information generated by application activities into log files. Records saved in the log file are called logs. Logs are a simple way of persisting info about your application.

A log is the first place to look as a programmer to track down errors and flow of events, especially from a server.

When it comes to tracking errors during development, you would typically use console.log or run a debugger.

But when the application goes to production level and the user starts interacting with it, you…

--

--

Yasas Sandeepa
Yasas Sandeepa

Written by Yasas Sandeepa

An energetic highly motivated Tech Enthusiastic. First-Class Honours | BSc (Hons) in Information Technology | University of Moratuwa✨Web: bit.ly/yasas4d

Responses (3)

Write a response