Logging Abstraction in NodeJS Using Winston, Typescript

--

Photo by Jon Flobrant on Unsplash

This is part two and example of the logging best practices. For part 1: Logging Best Practices with Example.

Features

  • Logging at multiple different levels.
  • Discarding debug messages in production.
  • Writing log messages also file in production.
  • Maximum file size of log files.
  • The daily rotation of log files.
  • Preserving log files for a period of time
  • Compressing log files
  • Structured logging
  • Including context in a log message

Cons

  • Function, file name, and line number not be shown in the log message.

--

--