CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-signale

Hackable console logger for Node.js applications with 17 out-of-the-box logger types and advanced features including integrated timers, scoped loggers, secrets filtering, and custom pluggable loggers.

Pending
Overview
Eval results
Files

core-logging.mddocs/

Core Logging

Built-in logger types with pre-configured styling and behavior for common logging scenarios. Signale provides 17 default loggers, each with unique visual styling and semantic meaning.

Capabilities

Default Logger Methods

All default loggers are available as methods on the main signale instance and follow the same calling pattern.

/**
 * Built-in logger methods available on signale instance
 * Each method accepts the same message parameter types
 */

// Status and progress loggers
signale.await(message);     // Waiting/loading states with blue ellipsis
signale.complete(message);  // Completed tasks with cyan checkbox
signale.pending(message);   // Pending tasks with magenta empty checkbox
signale.start(message);     // Started processes with green play symbol
signale.pause(message);     // Paused processes with yellow square
signale.watch(message);     // Watching/monitoring with yellow ellipsis
signale.wait(message);      // General waiting with blue ellipsis

// Result and feedback loggers  
signale.success(message);   // Successful operations with green checkmark
signale.error(message);     // Error conditions with red cross
signale.fatal(message);     // Fatal errors with red cross
signale.warn(message);      // Warnings with yellow warning symbol
signale.info(message);      // Information with blue info symbol
signale.debug(message);     // Debug information with red dot
signale.note(message);      // Notes with blue bullet
signale.star(message);      // Starred/important with yellow star
signale.fav(message);       // Favorites with magenta heart
signale.log(message);       // Plain logging (no badge/color)

// Message parameter types
type LogMessage = 
  | string                    // Simple string message
  | string[]                  // Multiple string arguments (joined with spaces)
  | MessageObject             // Object with prefix/suffix
  | Error;                    // Error object (displays stack trace)

interface MessageObject {
  prefix?: string;    // Text shown before the badge/label
  message: string | string[];  // Main message content
  suffix?: string;    // Text shown after the message
}

String Interpolation

All loggers support Node.js util.format() style string interpolation with placeholders.

Usage Examples:

const signale = require('signale');

// Basic string interpolation
signale.info('Processing %d files', 42);
signale.success('User %s logged in successfully', 'alice');
signale.pending('Loading %s data from %s...', 'user', 'database');

// Multiple arguments (automatically joined)
signale.debug('Database', 'connection', 'established');
// Output: ⬤  debug    Database connection established

// Complex interpolation
signale.warn('Invalid config value: %j', { timeout: -1 });
signale.error('Failed to connect to %s:%d after %d attempts', 'localhost', 3000, 3);

Message Object Format

Use message objects for structured output with prefixes and suffixes.

Usage Examples:

const signale = require('signale');

// Basic message object
signale.complete({
  prefix: '[task]',
  message: 'Fix issue #59',
  suffix: '(@username)'
});
// Output: [task] ☒  complete  Fix issue #59 (@username)

// Array message with formatting
signale.pending({
  prefix: '[deploy]',
  message: ['Uploading', 'files', 'to', 'server'],
  suffix: '(3/5)'
});
// Output: [deploy] ◯  pending  Uploading files to server (3/5)

// Interpolation in message objects
signale.success({
  message: 'Processed %d items successfully',
  suffix: '✨'
}, 150);

Error Object Handling

Error objects receive special formatting with stack trace display.

Usage Examples:

const signale = require('signale');

// Error object logging
try {
  throw new Error('Database connection failed');
} catch (err) {
  signale.error(err);
  // Output: ✖  error  Error: Database connection failed
  //                    at Object.<anonymous> (/path/to/file.js:3:9)
  //                    at Module._compile (module.js:660:30)
  //                    ... (full stack trace)
}

// Fatal error logging
signale.fatal(new TypeError('Invalid configuration object'));

Logger Properties

Each built-in logger has specific visual and behavioral properties:

// Logger configurations (from types.js)
const loggerTypes = {
  await: { badge: '⋯', color: 'blue', label: 'awaiting', logLevel: 'info' },
  complete: { badge: '☑', color: 'cyan', label: 'complete', logLevel: 'info' },
  debug: { badge: '⬤', color: 'red', label: 'debug', logLevel: 'debug' },
  error: { badge: '✖', color: 'red', label: 'error', logLevel: 'error' },
  fatal: { badge: '✖', color: 'red', label: 'fatal', logLevel: 'error' },
  fav: { badge: '❤', color: 'magenta', label: 'favorite', logLevel: 'info' },
  info: { badge: 'ℹ', color: 'blue', label: 'info', logLevel: 'info' },
  log: { badge: '', color: '', label: '', logLevel: 'info' },
  note: { badge: '∙', color: 'blue', label: 'note', logLevel: 'info' },
  pause: { badge: '■', color: 'yellow', label: 'pause', logLevel: 'info' },
  pending: { badge: '◯', color: 'magenta', label: 'pending', logLevel: 'info' },
  star: { badge: '✦', color: 'yellow', label: 'star', logLevel: 'info' },
  start: { badge: '▶', color: 'green', label: 'start', logLevel: 'info' },
  success: { badge: '✔', color: 'green', label: 'success', logLevel: 'info' },
  wait: { badge: '⋯', color: 'blue', label: 'waiting', logLevel: 'info' },
  warn: { badge: '⚠', color: 'yellow', label: 'warning', logLevel: 'warn' },
  watch: { badge: '⋯', color: 'yellow', label: 'watching', logLevel: 'info' }
};

Log Level Filtering

Loggers respect the instance's logLevel setting for output filtering:

  • info: Shows all loggers (default)
  • timer: Shows timer, debug, warn, error, fatal loggers
  • debug: Shows debug, warn, error, fatal loggers
  • warn: Shows warn, error, fatal loggers
  • error: Shows error, fatal loggers only

Usage Examples:

const { Signale } = require('signale');

const logger = new Signale({ logLevel: 'warn' });

logger.info('This will not appear');     // Filtered out
logger.debug('This will not appear');    // Filtered out  
logger.warn('This will appear');         // Shown
logger.error('This will appear');        // Shown
logger.fatal('This will appear');        // Shown

Install with Tessl CLI

npx tessl i tessl/npm-signale

docs

advanced-features.md

configuration.md

core-logging.md

custom-loggers.md

index.md

scoped-loggers.md

timers.md

tile.json