node-pretty-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

node-pretty-logger

Simple library extending console.log functionality

A minimal Node.js terminal console.log extension library with formatting for better readability.

Implementation documentation can be found on https://salmon42.github.io/node-pretty-logger.


Installation

You can install this package from NPM registry https://www.npmjs.com/package/node-pretty-logger.

npm install node-pretty-logger

Usage

The main exported function useLogger has one parameter tag. Instantiating the encapsulated log functions will ensure that the console log will always mention in what context it is being run in - useful if using multiple loggers across modules.

const { info, success, warn, error } = useLogger('MainSrc')
const { info: ofInfo } = useLogger('OtherFunc')

const someData = {
	attr1: 10,
	attr2: 'Hi',
}

info('info')
success('success')
warn('warn')
error('error')

setLoggerConfig({ showTimeStamp: false })
info('Test', someData)

setLoggerConfig({ showTimeStamp: true })
ofInfo('Test', someData)

Outputs:

License

This library is released under MIT license, which means that you can reuse any part of code here for your convenience.

Copyright (C) 2025-present, Andrej Hučko

If you like this library, don't hesitate to give this repository a star! 😊

  • ~

Package Sidebar

Install

npm i node-pretty-logger

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

9.21 kB

Total Files

6

Last publish

Collaborators

  • salmon42