A lightweight and developer-friendly logging library that allows you to print colorful messages to the console, complete with the filename and line number of the caller. This library is compatible with Angular, React, and plain JavaScript projects.
- 🌈 Log messages in vibrant colors.
- 📂 Automatically fetches the file and line number of the caller.
- 🛠️ Compatible with modern frontend frameworks like Angular, React, and vanilla JavaScript.
- 🔒 Follows best practices for security and performance.
- 📦 Lightweight and easy to integrate.
Install the package via npm:
npm install rm-colorful-console-logger
Or with Yarn:
yarn add rm-colorful-console-logger
Import and use the library in your project:
import { Log } from 'rm-colorful-console-logger';
Log.success('Hello, World!', 'green'); // Logs "Hello, World!" in green
Log.error('This is an error message', 'red'); // Logs "This is an error message" in red
Log.info('This is an error message', 'blue'); // Logs "This is an error message" in blue
Parameter | Type | Default | Description |
---|---|---|---|
message |
string |
Required |
The message to log. |
color |
string |
Optional Default is green red blue |
The color for the message (e.g., green red , blue , yellow ). |
To log messages dynamically based on runtime conditions:
const isError = true;
const message = isError ? 'Something went wrong!' : 'All systems operational.';
const color = isError ? 'red' : 'green';
Log.success(message, color);
Log.error(message, color);
Log.info(message, color);
This library works seamlessly in:
- Angular 8+
- React 16.8+
- Node.js 14+
(Feel free to add compatibility notes for other environments.)
This library does not store or expose any sensitive information. It is designed to operate purely on the client side. If you find any vulnerabilities, please report them.
This project is licensed under the MIT License. See the LICENSE file for details.
If you identify any errors in this component, or have an idea for an improvement, please open an issue. I am excited to see what the community thinks of this project, and I would love your input!
Are you interested in this library but lacks features? Write to the author, he can do it for you.
Rajat Malik