@halibal/colorful-log
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Colorful Log Package

A simple and customizable colorful console logger for Node.js applications written in TypeScript. This package allows you to log messages with different colors and formatting options such as bold and underline.

Update 0.0.3

  • Now you can colorfulLog the FormData types, too.
  • functions and symbols converted to strings.
  • undefined and null values are explicitly converted to string.
  • special objects:
    • Blob is handled.
  • added basic test scenarios

Installation

You can install this package using npm:

npm i @halibal/colorful-log

pnpm:

pnpm add @halibal/colorful-log

Usage

Import the colorfulLog function and use it to log messages with different colors and formatting options.

import { colorfulLog } from 'colorful-log';

const nestedObject = {
    status: 'ok',
    details: {
        user: 'john',
        roles: ['admin', 'user'],
        metadata: {
            lastLogin: new Date(),
            preferences: {
                theme: 'dark',
                notifications: true
            }
        }
    }
};

colorfulLog('green', ['Operation successful:', nestedObject], ['underline']);
colorfulLog(
    'red',
    ['Error occurred:', { message: 'Something went wrong', code: 500 }],
    ['bold']
);
colorfulLog('blue', ['This is an info message'], ['bold', 'underline']);
colorfulLog('purple', ['This is a regular message with no extra formatting']);

Available Colors

The following colors are available for logging:

  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Purple
  • White

Available Colors

The following colors are available for logging:

  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Purple
  • White

Formatting Options

In addition to colors, you can also add formatting options:

  • Bold
  • Underlined
  • Bold & Underlined

License

This project is licensed under the MIT License.

Package Sidebar

Install

npm i @halibal/colorful-log

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

8.79 kB

Total Files

9

Last publish

Collaborators

  • halibal