Registry / devops / pino-pretty-logs

pino-pretty-logs

JSON →
library2.0.0jsnpmunverified

A preconfigured Pino logger with colorized, human-readable output for development environments. Version 2.0.0 provides a ready-to-use logger with built-in pretty printing via pino-pretty, Pino-roll for log rotation, and Day.js for timestamps. Designed as a lightweight wrapper around Pino (currently pinned to 9.x) that eliminates boilerplate for Node.js applications. Its key differentiator is zero-config setup for colorful console logs while supporting structured JSON logging in production through the same interface.

npm install pino-pretty-logs
INSTALL
IMPORT
SIG · PINO-PRETTY-LOGS
P
pino-pretty-logs
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Logger
import { Logger } from 'pino-pretty-logs'
import Logger from 'pino-pretty-logs'
Logger is a named export, not default. Common mistake: trying default import.
default
import pinoPrettyLogs from 'pino-pretty-logs'
const pinoPrettyLogs = require('pino-pretty-logs')
Package is ESM-only; CommonJS require will fail. Also, the default export returns a preconfigured logger instance, not a class.
getLogger
import { getLogger } from 'pino-pretty-logs'
const { getLogger } = require('pino-pretty-logs')
Named export, but require() is not supported.
PinoLogger
import { PinoLogger } from 'pino-pretty-logs'
Type import for TypeScript: import type { PinoLogger } from 'pino-pretty-logs'

Shows basic usage: instantiate Logger, then log at various levels with optional error object.

import { Logger } from 'pino-pretty-logs'; const logger = new Logger(); logger.info('Server started on port 3000'); logger.warn('Disk space low'); logger.error(new Error('Connection failed'), 'Failed to connect');
Debug
Known issues
breakingVersion 2.0.0 only supports ESM imports; CommonJS require will throw an error.
fix
Use ESM imports (import) or downgrade to v1.x if you need CommonJS.
affects: >=2.0.0
breakingIn v2.0.0, the constructor signature changed: new Logger() no longer accepts options directly; use the static create() method or configure via environment variables.
fix
Use Logger.create({ level: 'debug' }) or set PINO_LOG_LEVEL environment variable.
affects: >=2.0.0
deprecatedThe getLogger() function is deprecated and will be removed in v3.0.0.
fix
Use new Logger() or Logger.create() instead.
affects: >=2.0.0
gotchapino-pretty-logs requires pino version 9.x; installing a different major version (e.g., 8.x) will cause type errors or runtime failures.
fix
Ensure pino@9.x is installed as a dependency.
affects: >=2.0.0
gotchaThe default export returns a singleton logger instance; mutating it affects all consumers. Use named exports to get independent instances.
fix
Import { Logger } or { getLogger } instead of the default export.
affects: >=2.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Using require() to import an ESM-only package.
fix
Change to import statement or set type: module in package.json, or use dynamic import().
TypeError: Logger is not a constructor
Importing the default export incorrectly (e.g., import Logger from ... instead of import { Logger } from ...).
fix
Use named import: import { Logger } from 'pino-pretty-logs'
Cannot find module 'pino'
pino is a peer dependency but not installed.
fix
Run npm install pino or add pino to your project's dependencies.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
pinorequiredCore logging library; wrapped by this package.
pino-prettyrequiredTransports logs to human-readable colorized output.
pino-rollrequiredProvides log rotation functionality.
dayjsrequiredUsed for timestamp formatting.
Agent activity
6 hits · last 30 days
node
6
Resources
pino-pretty-logs — npm install pino-pretty-logs · libregistry