Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 2, 2024 via pnpm

winston 3.11.0

A logger for just about everything.
Package summary
Share
0
issues
2
licenses
30
MIT
1
ISC
Package created
18 Jan 2011
Version published
7 Oct 2023
Maintainers
8
Total deps
31
Direct deps
11
License
MIT

Issues

0
This package has no issues

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
30 Packages, Including:
@colors/colors@1.6.0
@dabh/diagnostics@2.0.3
@types/triple-beam@1.3.5
async@3.2.5
color-convert@1.9.3
color-name@1.1.3
color-name@1.1.4
color-string@1.9.1
color@3.2.1
colorspace@1.1.4
enabled@2.0.0
fecha@4.2.3
fn.name@1.1.0
is-arrayish@0.3.2
is-stream@2.0.1
kuler@2.0.0
logform@2.6.0
ms@2.1.3
one-time@1.0.0
readable-stream@3.6.2
safe-buffer@5.2.1
safe-stable-stringify@2.4.3
simple-swizzle@0.2.2
stack-trace@0.0.10
string_decoder@1.3.0
text-hex@1.0.0
triple-beam@1.4.1
util-deprecate@1.0.2
winston-transport@4.7.0
winston@3.11.0

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
inherits@2.0.4
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

11
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
@colors/colors1.6.01 BMIT
prod
@dabh/diagnostics2.0.39.79 kBMIT
prod
async3.2.5146.47 kBMIT
prod
is-stream2.0.12.17 kBMIT
prod
logform2.6.025.6 kBMIT
prod
one-time1.0.02.63 kBMIT
prod
readable-stream3.6.232.46 kBMIT
prod
safe-stable-stringify2.4.36.97 kBMIT
prod
stack-trace0.0.103.51 kBMIT
prod
triple-beam1.4.11 BMIT
prod
winston-transport4.7.011.56 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.