0.1.8 • Published 9 months ago

bunny-log v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

BunnyLog 🐇

BunnyLog is a simple and customizable logging utility for Node.js applications. It allows you to log messages with different categories and colors, making it easier to distinguish between various types of log messages.

Features

  • Category-based Logging: Log messages with different categories such as server, database, error, info, success, warn, and api.
  • Color-coded Output: Each category is associated with a specific color for easy identification.
  • JSON Object Logging: Automatically formats and colorizes JSON objects for better readability.
  • Dynamic Custom Category: Easily add new log categories with custom colors at runtime.

Installation

npm install bunnylog

Usage

Import BunnyLog

import { bunnyLog } from './bunnyLog';

Logging Messages

bunnyLog.server( 'This is server message.')
bunnyLog.info('This is an informational message.');
bunnyLog.error('An error occurred:', new Error('Sample error'));
bunnyLog.success('Operation completed successfully.');
bunnyLog.warning('This is a warning message.');
bunnyLog.api('API request received');
bunnyLog.database('Database message.')
bunnyLog.object({ key: 'value', anotherKey: 42 });

Adding a New Category

You can dynamically add new categories with custom colors:

import chalk from 'chalk'

// Add a new log category 'debug' with a custom color
bunnyLog.addCategory('debug', chalk.cyan)
bunnyLog.addCategory('debug', chalk.hex('#ffffff')) // you can also use hex code

// Use the new category
bunnyLog.debug('This is a debug message.')

Example Outputs

Server

Info

Error

Success

Warning

Api

Database

Object

Custom Category

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License.

0.1.2

10 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.4

9 months ago

0.1.3

10 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.1

10 months ago

0.0.85

11 months ago

0.0.91

11 months ago

0.0.92

11 months ago

0.1.0

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago