Skip to content

A lightweight library for colorful console logging with filename and line number.

License

Notifications You must be signed in to change notification settings

malikrajat/rm-colorful-console-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colorful Console Logger

npm version License: MIT Downloads

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.


🚀 Features

  • 🌈 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.

📦 Installation

Install the package via npm:

  npm install rm-colorful-console-logger

Or with Yarn:

  yarn add rm-colorful-console-logger

🛠️ Usage

Basic Usage

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

Parameters

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).

Advanced Usage

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);

🌐 Compatibility

This library works seamlessly in:

  • Angular 8+
  • React 16.8+
  • Node.js 14+

(Feel free to add compatibility notes for other environments.)


🛡️ Security

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.


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


Issues

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!

Author services

Are you interested in this library but lacks features? Write to the author, he can do it for you.

Author

Rajat Malik

About

A lightweight library for colorful console logging with filename and line number.

Resources

License

Stars

Watchers

Forks

Packages

No packages published