@halibal/colorful-log
v0.0.3
Published
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.
Downloads
4
Maintainers
Readme
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
theFormData
types, too. functions
andsymbols
converted to strings.undefined
andnull
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:
Formatting Options
In addition to colors, you can also add formatting options:
License
This project is licensed under the MIT License.