DEV Community

Discussion on: What JS Logging library / tool do you use?

Collapse
 
jasman7799 profile image
Jarod Smith

A) I use a combination of morgan for request logging, and Winston for error logs.

B) I structure my logs into information logs, warning logs, request logs, and error logs.

  • The information logs are used for things like user sign-in, database modifications, and algorithm analysis.
  • Warning logs are things like the user was denied access, A resource is using up too much memory or taking too long, or a result that doesn't break the system, but could be a problem for the user.
  • Error logs are reserved for runtime errors or anything where a system actually failed to perform its job.
  • The request logs are handled by Morgan and they mainly log the request made to the server, the parsed query (using GraphQL), and the response to the user.

C) I store my logs in a logs folder on the production server. They are organized into 3 files based on the level of severity, and each log entry is prepended with a time stamp, and the userId if applicable.