Skip to content
A common logging module for the webpack ecosystem
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
docs docs(readme): standardize (#9) Sep 21, 2018
src chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
test test: add output tests (#25) Jul 15, 2019
.editorconfig actual initial commit. note: this will fail CI as loglevelnext Dec 17, 2017
.eslintrc chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
.gitignore ci(travis): add build stages Aug 23, 2018
.prettierignore chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
.prettierrc.js chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
.travis.yml ci(travis): add build stages Aug 23, 2018
CHANGELOG.md chore(release): 2.0.0 Aug 23, 2018
CONTRIBUTING.md chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
LICENSE revert addition of not owned code (#14) Nov 3, 2018
README.md chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
commitlint.config.js chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
husky.config.js chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
jest.config.js test: introduce jest (#24) Jul 11, 2019
lint-staged.config.js chore: introduce prettier, husky commitlint and lint-staged (#21) Jul 10, 2019
package-lock.json test: introduce jest (#24) Jul 11, 2019
package.json test: introduce jest (#24) Jul 11, 2019

README.md

npm node deps test coverage chat

webpack Log

A common logging module for the webpack ecosystem

Install

npm i -D webpack-log

⚠️ We do not recommend installing this module globally

Usage

const log = require('webpack-log');
const logger = log({ name: 'wds' });

logger.info('Server Starting');

output

ℹ️ The logger returned is unique by default, due to the nature of the webpack ecosystem. Please reference the unique option below for disabling this feature and to force caching

Options

Name Type Default Description
name {String} ''<unknown>' Log Name (Required)
level {String} 'info' Log Level
unique {Boolean} true Log Uniqueness
timestamp {Boolean} false Log Timestamps

name

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

const logger = log({ name: 'wds' });

level

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:

['info', 'warn', 'error', 'trace', 'debug', 'silent'];
const logger = log({ level: 'error' });

logger.error(err);

ℹ️ The level names shown above correspond to the available logging methods, with the notable exception of the silent level

unique

If false, instructs the logger to used cached versions of a log with the same name. Due to the nature of the webpack ecosystem and multiple plugin/loader usage in the same process, loggers are created as unique instances by default. By passing false for this property, the module is instructed to cache the requested logger

const logger = log({ unique: true });

timestamp

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

const logger = log({ timestamp: true });
You can’t perform that action at this time.