New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

charmlog

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

charmlog

Library to improve logging

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
0
Created
Source

CharmLog 🎨

Check GitHub code size in bytes npm npm version License

Make your terminal string output even more beautiful 💖

A modern, lightweight logging library for Node.js that provides beautiful colored output, rainbow text, custom formatting, and structured logging capabilities.

✨ Features

  • 🎨 Rich Color Support - 16 basic colors with bright variants
  • 🌈 Rainbow Text - Multi-colored text output
  • 📝 Custom Formatting - printf-style formatting with colors and styles
  • 📊 Structured Logging - Logger class with log levels
  • 🔍 Object Inspection - Beautiful object/array visualization
  • 🎯 TypeScript Support - Full type definitions included
  • 📦 Tree-shakable - Only import what you need
  • 🚀 Zero Dependencies - Lightweight and fast

📦 Installation

Prerequisites

  • Node.js 14.0.0 or higher

Install

npm install charmlog

🚀 Quick Start

// ES Modules
import charmlog from 'charmlog';

// CommonJS
const charmlog = require('charmlog').default;

// Basic usage
charmlog.blue('Hello, World!');
charmlog.rainbow('This is a rainbow text!');
charmlog.printf('Custom formatted text');

📚 API Reference

Basic Colors

// Basic colors
charmlog.red('Error message');
charmlog.green('Success message');
charmlog.yellow('Warning message');
charmlog.blue('Info message');
charmlog.magenta('Debug message');
charmlog.cyan('Trace message');
charmlog.white('Normal message');
charmlog.black('Dark message');

Rainbow Text

// Rainbow colored text
charmlog.rainbow('This text will be rainbow colored!');

Custom Formatting

// Set formatting options
charmlog.settings.color = '#ff0000';
charmlog.settings.backgroundColor = '#000000';
charmlog.settings.fontWeight = 'bold';
charmlog.settings.style = 'italic';

// Apply formatting
charmlog.printf('Custom formatted text');

Structured Logging

import { Logger } from 'charmlog';

const logger = new Logger('info');

logger.debug('Debug message');
logger.info('Info message');
logger.warning('Warning message');
logger.error('Error message');
logger.critical('Critical message');

Object Inspection

const obj = {
  name: 'John',
  age: 30,
  hobbies: ['coding', 'reading'],
  address: {
    city: 'New York',
    country: 'USA'
  }
};

charmlog.dir(obj);

Core Functions

import { charmprint, createCharmedObject } from 'charmlog';

// Wrap any function to auto-log its output
const wrappedFn = charmprint((a, b) => a + b);
wrappedFn(2, 3); // Logs: 5

// Create a charmed object
const myObj = createCharmedObject({
  greet: (name) => `Hello, ${name}!`
});
myObj.greet('World'); // Auto-logs the result

🎯 Advanced Usage

Custom Color Methods

import { colors } from 'charmlog';

// Access individual color methods
colors.red('This is red');
colors.green('This is green');

Logger Configuration

import { Logger } from 'charmlog';

const logger = new Logger('warning', true); // Only show warnings and above

logger.setLogLevel('error'); // Change log level
logger.reset(); // Reset to default settings

Settings Management

import { settings } from 'charmlog';

// Configure text formatting
settings.color = '#ff0000';
settings.backgroundColor = 'transparent';
settings.fontWeight = 'bold';
settings.style = 'normal';
settings.textDecoration = 'underline';

// Reset all settings
settings.reset();

🔧 Configuration

TypeScript

The library includes full TypeScript support with comprehensive type definitions.

Build Tools

CharmLog is compatible with:

  • Rollup
  • Webpack
  • Vite
  • esbuild
  • Parcel

Tree Shaking

// Only import what you need
import { red, green } from 'charmlog';
import { Logger } from 'charmlog';

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/antisedativ/CharmLog.git
cd CharmLog
npm install
npm run build
npm test

Made with ❤️ by the Charmlog

Keywords

javascript

FAQs

Package last updated on 25 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts