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

slick-log

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slick-log

A powerful and flexible logging utility for Node.js applications

latest
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

slick-log

A simple, yet flexible & powerful logging utility for Node.js applications with beautiful console output and file logging capabilities.

Features

  • Beautiful colored console output with decorative borders for errors
  • File logging disabled by default - only console logging until explicitly enabled
  • File logging with automatic rotation
  • Separate error log file
  • Configurable log levels
  • Timestamp formatting
  • Log file size management
  • Automatic log rotation
  • TypeScript support
  • Easy enable/disable file logging control

Installation

npm install slick-log

Quick Start

import { Logger, LogLevel } from 'slick-log';

// Console logging only (default behavior)
Logger.info('This only goes to console');
Logger.success('Success message');
Logger.error('Error with decorative border');

// Optional: Set log level (defaults to INFO)
Logger.setLogLevel(LogLevel.DEBUG);

// Optional: Enable file logging
Logger.setLogFiles('./logs/app.log', './logs/error.log');
Logger.info('This goes to both console and files');

// Optional: Disable file logging again
Logger.disableFileLogging();
Logger.info('Back to console only');

Log Levels

The logger supports the following log levels (in order of severity):

  • DEBUG (DEBG) - Detailed debugging information
  • INFO (INFO) - General information about program execution
  • SUCCESS (SUCC) - Successful operations
  • WARN (WARN) - Warning messages
  • ERROR (EROR) - Error messages
  • FATAL (FATL) - Fatal errors that may lead to program termination

Configuration

Log Level

import { Logger, LogLevel } from 'slick-log';

// Set minimum log level
Logger.setLogLevel(LogLevel.DEBUG);

// Get current log level
const currentLevel = Logger.getLogLevel();

File Logging Control

import { Logger } from 'slick-log';

// Check if file logging is enabled (false by default)
const isEnabled = Logger.isFileLoggingEnabled();

// Enable file logging
Logger.setLogFiles('./logs/app.log', './logs/error.log');

// Disable file logging (console logging continues)
Logger.disableFileLogging();

// Configure file size (default: 100MB)
Logger.setMaxFileSize(50); // 50MB

// Configure number of rotated files (default: 5)
Logger.setMaxRotatedFiles(3);

// Wait for all pending file writes to complete
await Logger.waitForWrites();

Output Format

Console Output

The logger provides beautiful, color-coded console output with centered log level labels:

  • DEBUG: Gray background with white text
  • INFO: Blue background with white text
  • SUCCESS: Green background with black text
  • WARN: Yellow background with black text
  • ERROR: Red background with white text + decorative borders
  • FATAL: Bright red background with white text + decorative borders

File Output

Log files contain entries in the following format:

YYYY-MM-DD HH:mm:ss [LEVEL] Message

Default Behavior

  • Console logging: Always enabled
  • File logging: Disabled by default - only starts when you call setLogFiles()
  • Log level: INFO (logs INFO, SUCCESS, WARN, ERROR, FATAL)
  • File rotation: 100MB max size, keeps 5 rotated files

TypeScript Support

This package is written in TypeScript and includes type definitions.

License

ISC

Keywords

logger

FAQs

Package last updated on 14 Jun 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