log-glow
v0.1.2
Published
log-glow is a versatile, developer-friendly logging tool designed to enhance the logging experience across various JavaScript environments, including Node.js, web browsers, and React Native. It brings a vibrant and organized approach to console logging, m
Downloads
7
Maintainers
Readme
Log-glow
log-glow is a versatile logging tool designed to enhance the development experience across various JavaScript environments, including Node.js, web browsers, and React Native. It brings clarity and organization to your console logs with color coding and environment-specific functionality.
Features
Developers often struggle with cluttered and hard-to-read console logs, especially when dealing with complex applications. log-glow addresses this issue by:
Color-Coding Logs: Making logs more readable and distinguishable.
Environment-Specific Logging: Reducing noise in production logs by enabling verbose logging only in development environments.
Problems Solved
During development, it's common to encounter the following challenges:
Difficulty in distinguishing between various types of log messages.
Console logs becoming cluttered and overwhelming, especially in production environments.
Spending excessive time debugging due to unclear log outputs. log-glow tackles these problems by providing a clear, customizable, and environment-aware logging solution.
How to use
Install log-glow using npm:
npm install log-glow
or using yarn
yarn add log-glow
Usage
Import log-glow into your project:
import {cls} from 'log-glow';
Basic Logging
cls('Hello, world!', { label: 'info', color: 'blue' });
Props
message: The message you want to log.
options: An object containing:
label: A string indicating the type of log (e.g., 'error', 'red').
color: (Optional) A string specifying the color for the log message.
Color to pass
red - Red for error.
yellow - Yellow for warning.
green - green for success.
blue - Blue for info
purple - Purple for any custom message.
Example
Log an error message in red:
cls('An error occurred', { label: 'error', color: 'red' });
Log a success message in green without specifying the color explicitly:
cls('Operation successful', { label: 'success' });
🔗 Links
Feedback
If you have any feedback, please reach out to us at [email protected]