Registry / web-framework / webpack-log

webpack-log

JSON →
library3.0.2jsnpmunverified

A logger for the Webpack ecosystem, currently at version 3.0.2. This library provides a simple logging API with configurable log levels (trace, debug, info, warn, error, silent), support for timestamps, and unique logger instances to avoid collisions in the Webpack multi-plugin environment. Version 3.0.0 was a complete rewrite, replacing ansi-colors with chalk and uuid with nanoid. It requires Node 8.0.0+. The project is actively maintained with a focus on Webpack plugin and loader development.

npm install webpack-log
INSTALL
IMPORT
SIG · WEBPACK-LOG
W
webpack-log
web-frameworkjavascriptv3.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getLogger
import getLogger from 'webpack-log'
const { getLogger } = require('webpack-log')
The package exports a single function as default. In ESM, use default import. In CJS, require returns the function directly.
LoggerOptions
type LoggerOptions = { name?: string; level?: string; timestamp?: boolean; unique?: boolean }
import { LoggerOptions } from 'webpack-log'
The package does not export TypeScript type declarations. You must define your own interface for options. Use the type shown for type safety.
getLogger (CJS)
const getLogger = require('webpack-log')
const { getLogger } = require('webpack-log')
In CommonJS, the default export is the function itself, not an object with a getLogger property. Destructuring will yield undefined.

Creates a logger instance with name 'my-plugin', level 'info', and timestamps enabled, then logs messages at various levels.

const getLogger = require('webpack-log'); const log = getLogger({ name: 'my-plugin', level: 'info', timestamp: true }); log.info('Logger initialized successfully'); log.warn('This is a warning'); log.error('An error occurred'); log.debug('This debug message will not appear because level is info');
Debug
Known issues
breakingThe `colors` option for customizing ANSI colors has been removed in v3. Use `chalk` directly or create your own logger.
fix
Remove the `colors` option from logger configuration. If you need custom colors, fork the package or use `chalk` manually.
affects: >=3.0.0
deprecatedThe `colors` property on the logger instance (e.g., `log.colors`) is deprecated in v3.
fix
Access color formatting through `chalk` instead of `log.colors`.
affects: >=3.0.0
gotchaLoggers with the same `name` are cached by default (unique: true), meaning two calls with the same name return the same instance. To create distinct loggers, set `unique: true` explicitly.
fix
In v2 and below, use `unique: true` to avoid sharing loggers. In v3, unique defaults to true, so no change needed.
affects: <3.0.0
Errors
Common errors & fixes
TypeError: getLogger is not a function
Destructuring the required object as `const { getLogger } = require('webpack-log')` instead of direct assignment.
fix
Change `const { getLogger } = require('webpack-log')` to `const getLogger = require('webpack-log')`.
Error: You must specify a name for the logger
Calling `getLogger()` without a `name` in the options object (required in v3).
fix
Add `name` to the options: `getLogger({ name: 'my-logger' })`.
Cannot find module 'webpack-log'
Package not installed or wrong package name.
fix
Run `npm install webpack-log --save-dev` (or `--save` if not dev dependency).
Upgrade
Version history
3.0.2latest on npm
Audit
Dependencies
loglevelnextrequiredcore logging functionality
chalkrequiredcolored console output (replaced ansi-colors in v3)
nanoidrequiredunique logger ID generation (replaced uuid in v3)
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
webpack-log — npm install webpack-log · libregistry