
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
missionlog
Advanced tools
π lightweight TypeScript abstract logger β’ level based filtering and optional tagging β’ supports both ESM & CJS
π missionlog is a lightweight, high-performance structured logging package designed for performance, flexibility, and ease of use. It works as a drop-in replacement for console.log or ts-log, and offers both log level filtering, optional tag filtering, and customizable output handlingβall in a tiny (~1KB) package.
β Fully Typed (TypeScript) β’ β ESM & CJS Support β’ β Zero Dependencies β’ β 100% Coverage β’ β Optimized Performance
missionlog?console.log & ts-log β Start using it instantly!missionlog v4 has been optimized for high-performance applications:
Perfect for high-frequency logging scenarios like real-time applications, games, and data processing pipelines.
npm i missionlog
Missionlog works as a drop-in replacement for console.log:
import { log } from 'missionlog';
// Works just like console.log
log.info('Hello, world!');
log.warn('Warning message');
log.error('Error occurred!');
// Chainable API for fluent logging
log.debug('Starting process').info('Process step 1 complete').warn('Process running slowly');
import { log, tag, LogLevel, DEFAULT_TAG } from 'missionlog';
// Configure logging levels for different tags
log.init({
network: LogLevel.DEBUG,
ui: LogLevel.INFO,
[DEFAULT_TAG]: LogLevel.WARN, // Default level for uncategorized logs
});
// Log with type-safe tags - autocomplete shows available tags!
log.debug(tag.network, 'Connection established');
log.info(tag.ui, 'Component rendered');
// Typos in tags return undefined, preventing silent errors
log.debug(tag.netwrok, 'This will be logged without tag due to typo');
// Untagged logs use the DEFAULT_TAG level
log.debug("This won't be logged because DEFAULT_TAG is WARN");
log.error('This will be logged because ERROR > WARN');
import { log, LogLevel, LogLevelStr } from 'missionlog';
import chalk from 'chalk';
// Create a custom log handler
function createCustomHandler() {
const logConfig: Record<LogLevelStr, { color: (text: string) => string; method: (...args: unknown[]) => void }> = {
ERROR: { color: chalk.red, method: console.error },
WARN: { color: chalk.yellow, method: console.warn },
INFO: { color: chalk.blue, method: console.log },
DEBUG: { color: chalk.magenta, method: console.log },
TRACE: { color: chalk.cyan, method: console.log },
OFF: { color: () => '', method: () => {} },
};
return (level: LogLevelStr, tag: string, message: unknown, params: unknown[]) => {
const { method, color } = logConfig[level];
const logLine = `[${color(level)}] ${tag ? tag + ' - ' : ''}${message}`;
method(logLine, ...params);
};
}
// Initialize with custom handler
log.init({ network: LogLevel.INFO, [DEFAULT_TAG]: LogLevel.INFO }, createCustomHandler());
// Check if specific levels are enabled before performing expensive operations
if (log.isDebugEnabled('network')) {
// Only perform this expensive operation if DEBUG logs for 'network' will be shown
const stats = getNetworkStatistics(); // Example of an expensive operation
log.debug(tag.network, 'Network statistics', stats);
}
// Similarly for TRACE level
if (log.isTraceEnabled('ui')) {
// Avoid expensive calculations when trace logging is disabled
const detailedMetrics = calculateDetailedRenderMetrics();
log.trace(tag.ui, 'UI rendering detailed metrics', detailedMetrics);
}
// The general method is still available for other log levels
if (log.isLevelEnabled(LogLevel.WARN, 'security')) {
const securityCheck = performSecurityAudit();
log.warn(tag.security, 'Security audit results', securityCheck);
}
The enhanced callback functionality has been removed to simplify the API:
log.setEnhancedCallback() method removedLogCallbackParams interface removedEnhancedLogCallback type removedMigration: Use the standard callback in log.init() instead:
// β Old way (v3.x)
log.setEnhancedCallback((params) => {
const { level, tag, message, timestamp, params: extraParams } = params;
console.log(`[${timestamp.toISOString()}] [${level}] ${message}`, ...extraParams);
});
// β
New way (v4.x)
log.init({}, (level, tag, message, params) => {
const timestamp = new Date().toISOString();
console.log(`[${timestamp}] [${level}] ${message}`, ...params);
});
All logging methods support both tagged and untagged logging with full type safety:
log.trace(messageOrTag?, ...params) - Lowest verbosity levellog.debug(messageOrTag?, ...params) - Detailed debugging informationlog.info(messageOrTag?, ...params) - Notable but expected eventslog.log(messageOrTag?, ...params) - Alias for info()log.warn(messageOrTag?, ...params) - Potential issues or warningslog.error(messageOrTag?, ...params) - Error conditionslog.init(config?, callback?) - Configure log levels and custom handlerlog.isLevelEnabled(level, tag?) - Check if a specific level would be logged for a taglog.isDebugEnabled(tag?) - Convenience method to check if DEBUG level is enabledlog.isTraceEnabled(tag?) - Convenience method to check if TRACE level is enabledlog.reset() - Reset logger to initial state and clear all configurationstag.{tagName} - Access registered tags with runtime validationundefined otherwiseLogLevel.TRACE - Most verboseLogLevel.DEBUGLogLevel.INFO - Default levelLogLevel.WARNLogLevel.ERRORLogLevel.OFF - No logs
Contributions, issues, and feature requests are welcome! Feel free to check issues page or submit a pull request.
MIT License Β© 2019-2025 Ray Martone
π Install missionlog today and make logging clean, structured, and powerful!
FAQs
π lightweight TypeScript abstract logger β’ level based filtering and optional tagging β’ supports both ESM & CJS
The npm package missionlog receives a total of 9,345 weekly downloads. As such, missionlog popularity was classified as popular.
We found that missionlog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.