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.
npx @tessl/cli install tessl/npm-signale@1.4.0Signale is a hackable and configurable console logger for Node.js applications that provides 17 out-of-the-box logger types with clean and beautiful output formatting. It offers advanced features including integrated timers, custom pluggable loggers, interactive and regular modes, secrets filtering, filename/date/timestamp support, scoped loggers, scaled logging levels, string interpolation, multiple configurable writable streams, and global configuration through package.json.
npm install signaleconst signale = require('signale');For accessing the Signale class constructor:
const { Signale } = require('signale');const signale = require('signale');
// Use built-in loggers
signale.success('Operation successful');
signale.error('Something went wrong');
signale.warn('This is a warning');
signale.info('Informational message');
signale.debug('Debug information');
// String interpolation support
signale.pending('Processing %s items...', 42);
signale.complete({
prefix: '[task]',
message: 'Fix issue #59',
suffix: '(@username)'
});
// Handle Error objects
signale.fatal(new Error('Critical failure'));Signale is built around several key components:
Built-in logger types with pre-configured styling and behavior. Includes 16 default loggers for common logging scenarios.
// Default logger methods (available on signale instance)
signale.await(message);
signale.complete(message);
signale.debug(message);
signale.error(message);
signale.fatal(message);
signale.fav(message);
signale.info(message);
signale.log(message);
signale.note(message);
signale.pause(message);
signale.pending(message);
signale.star(message);
signale.start(message);
signale.success(message);
signale.wait(message);
signale.warn(message);
signale.watch(message);
// Message types supported
type LogMessage = string | string[] | {prefix?: string, message: string | string[], suffix?: string} | Error;Create and configure custom logger types with personalized badges, colors, labels, and behavior.
const { Signale } = require('signale');
// Constructor options
interface SignaleOptions {
disabled?: boolean;
interactive?: boolean;
logLevel?: 'info' | 'timer' | 'debug' | 'warn' | 'error';
scope?: string | string[];
secrets?: (string | number)[];
stream?: NodeJS.WritableStream | NodeJS.WritableStream[];
types?: Record<string, LoggerType>;
}
interface LoggerType {
badge?: string;
color?: string;
label?: string;
logLevel?: 'info' | 'timer' | 'debug' | 'warn' | 'error';
stream?: NodeJS.WritableStream | NodeJS.WritableStream[];
}
const customLogger = new Signale(options);Create hierarchical scoped loggers with inheritance for organized logging across different modules and components.
// Create scoped logger
function scope(...name: string[]): Signale;
// Remove scope
function unscope(): void;
// Properties
readonly scopeName: string;Integrated timer functionality for measuring operation duration with automatic labeling and formatted output.
// Timer methods
function time(label?: string): string;
function timeEnd(label?: string): {label: string, span: number} | undefined;Global and instance-level configuration options for customizing logger behavior, appearance, and output format.
// Configuration method
function config(settingsObj: ConfigOptions): void;
interface ConfigOptions {
displayScope?: boolean;
displayBadge?: boolean;
displayDate?: boolean;
displayFilename?: boolean;
displayLabel?: boolean;
displayTimestamp?: boolean;
underlineLabel?: boolean;
underlineMessage?: boolean;
underlinePrefix?: boolean;
underlineSuffix?: boolean;
uppercaseLabel?: boolean;
}Interactive mode, secrets filtering, stream management, and state control for advanced logging scenarios.
// State control
function disable(): void;
function enable(): void;
function isEnabled(): boolean;
// Secrets management
function addSecrets(secrets: (string | number)[]): void;
function clearSecrets(): void;
// Properties
readonly currentOptions: SignaleOptions;
readonly date: string;
readonly timestamp: string;
readonly filename: string;
readonly packageConfiguration: object;// Built-in logger type names
type DefaultLoggerType =
| 'await' | 'complete' | 'debug' | 'error' | 'fatal' | 'fav'
| 'info' | 'log' | 'note' | 'pause' | 'pending' | 'star'
| 'start' | 'success' | 'wait' | 'warn' | 'watch';
// Log levels for filtering
type LogLevel = 'info' | 'timer' | 'debug' | 'warn' | 'error';
// Scope definition
type ScopeNames = string | string[];
// Writable stream types (Node.js)
type WritableStream = NodeJS.WritableStream;
type StreamTarget = WritableStream | WritableStream[];