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.
- 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
You can install this package using npm:
npm i @halibal/colorful-log
pnpm:
pnpm add @halibal/colorful-log
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']);
The following colors are available for logging:
- Black
- Red
- Green
- Yellow
- Blue
- Purple
- White
The following colors are available for logging:
In addition to colors, you can also add formatting options:
This project is licensed under the MIT License.