JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4839911
  • Score
    100M100P100Q192832F
  • License MIT

A common logging module for the Webpack ecosystem

Package Exports

  • webpack-log

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm node deps tests coverage chat

webpack-log

A common logging module for the Webpack ecosystem. webpack-log leverages loglevelnext.

Getting Started

First thing's first, install the module:

npm install webpack-log --save

Note: We do not recommend installing this module globally.

Requirements

webpack-log requires Node v6 or higher.

Usage

const weblog = require('webpack-log');
const log = weblog({ name: 'wds' }) // webpack-dev-server

log.info('Server Starting');

The code above will produce:

output

Options

The default export (function) accepts an options Object. The following is a property reference for the Object.

level

Type: String
Default: 'info'

Specifies the level the logger should use. A logger will not produce output for any log level beneath the specified level. Available levels and order are:

[
  'trace',
  'debug',
  'info',
  'warn',
  'error',
  'silent'
]

Note: The level names shown above correspond to the available logging methods, with the notable exception of the silent level.

name

Required
Type: String
Default: '<unknown>'

Specifies the name of the log to create. This property is required, and used to differentiate between loggers when webpack-log is used in multiple projects executing in the same process space.

timestamp

Type: Boolean
Default: false

If true, instructs the logger to display a timestamp for log output, preceding all other data.

Contributing

We welcome your contributions! Please have a read of CONTRIBUTING.md for more information on how to get involved.

License

MIT