Winston is one of the most widely used logging libraries in Node.js applications. It’s designed to provide a highly customizable logging experience by separating concerns like log levels, formatting styles, and output destinations. atatus-winston is a winston plugin. With atatus-winston, you can take advantage of the winston logger framework with your Node.js app.

Add the dependency to your project

Configure atatus-winston

Use the samples in the code block below as a starting point, and replace the sample with a configuration that matches your needs.
Replace <YOUR_API_KEY> with your own Atatus api key.
If you do not have a Atatus account, you can sign up for a free trial here

Disable console logs

The winston logger by default sends all logs to the console. You can easily disable this by adding this line to your code :

Running with Typescript

If you don’t have a ‘tsconfig.json’ file start by running:
On your ‘tsconfig’ file, under ‘compilerOptions’ make sure you have ‘esModuleInterop’ flag with the value ‘true’ or add it this way:
Code sample:
Replace <YOUR_API_KEY> with your own Atatus api key.

Troubleshooting

To fix errors related to “esModuleInterop” flag make sure you run the relevant ‘tsconfig’ file. These might help:
or