Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 6, 2024 via pnpm

winston 2.4.6

A multi-transport async logging library for Node.js
Package summary
Share
2
issues
1
critical severity
license
1
1
moderate severity
meta
1
2
licenses
6
MIT
1
N/A
Package created
18 Jan 2011
Version published
28 Apr 2022
Maintainers
8
Total deps
7
Direct deps
6
License
MIT

Issues

2

1 critical severity issue

critical
Recommendation: Check the package code and files for license information
via: cycle@1.0.3
Collapse
Expand

1 moderate severity issue

moderate
via: eyes@0.1.8
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
async@3.2.5
colors@1.0.3
eyes@0.1.8
isstream@0.1.2
stack-trace@0.0.10
winston@2.4.6

N/A

N/A
1 Packages, Including:
cycle@1.0.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

6
All Dependencies CSV
β“˜ This is a list of winston 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
async3.2.5146.47 kBMIT
prod
colors1.0.387.07 kBMIT
prod
cycle1.0.33.19 kBUNKNOWN
prod
1
eyes0.1.85.09 kBMIT
prod
1
isstream0.1.23.67 kBMIT
prod
stack-trace0.0.103.51 kBMIT
prod

Visualizations

Frequently Asked Questions

What does winston do?

Winston is a versatile logging library for Node.js. It's designed to be simple, universal and with support for multiple transports. A transport in Winston is essentially a storage device for your logs. Each logger can have multiple transports configured at different levels. For example, one might want error logs to be stored in a persistent remote location (like a database), but all logs to output to the console or a local file. This offers a flexible and extensible logging solution that caters to a broad range of needs.

How do you use winston?

To use Winston in a JavaScript codebase, first, you need to install it via npm with npm install winston. After installation, create a logger using Winston's createLogger function. The function takes an object as a parameter, specifying the logging level, the format of the logs, and the transports.

For example:

const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  defaultMeta: { service: 'user-service' },
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' }),
  ],
});

if (process.env.NODE_ENV !== 'production') {
  logger.add(new winston.transports.Console({
    format: winston.format.simple(),
  }));
}

In the example, we're setting the log level to 'info', which means only events at this level and above will be logged. Logs are formatted in JSON and will be written to two different files: error.log for error logs and combined.log for logs with lower than the error log level. When not in production mode, logs are also outputted to the console.

Where are the winston docs?

The documentation for Winston can be found at the official Github repository here. The comprehensive documentation includes information on core concepts, capabilities, various options and detailed code examples to guide you on using the library effectively for your logging needs. Make sure to explore the examples folder for practical usage examples of the library.