🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

dev-log-monitor

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev-log-monitor

Lightweight local log diagnostics for NestJS, Express, and Node.js development with real-time UI, error tracing, and breadcrumbs

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

npm version License: MIT Node >= 18 Zero Dependencies Downloads

dev-log-monitor

Your existing logger + console.log(), but finally usable.
Real-time web UI • Error tracing • Breadcrumbs • Data masking • Zero dependencies

Website  •  npm  •  Issues


Quick Start

npm install dev-log-monitor
// Add this ONE LINE at the top of your entry file
import 'dev-log-monitor/auto';

// That's it. Open http://localhost:3333
console.log('This will appear in the dev-log UI!');

Auto-disables in production (NODE_ENV=production). Zero config needed.

Why dev-log-monitor?

ProblemSolution
"Which console.log printed this?"Source location tracking (file:line -> function())
"What happened before the crash?"Breadcrumbs - last 10 logs before any error
"I can't read these stack traces"Parsed & highlighted - your code vs node_modules
"Logs are flying by too fast"Real-time web UI with filtering, search, and export
"Sensitive data in logs"Auto-masks passwords, tokens, cards, SSNs (72+ fields)
"Different loggers everywhere"Works with console, Winston, Pino, Bunyan, or custom

Features

One-Line Integration
import 'dev-log-monitor/auto' intercepts all console methods, starts the UI, and enables masking.

Real-Time Web UI
Beautiful log viewer at localhost:3333 with WebSocket live updates, dark/light themes, and vim-style keyboard shortcuts.

Source Location
Every log shows file, line, column, and function name. No more guessing.

Breadcrumbs
See the last 10 logs before any error. Full context for every crash.

Sensitive Data Masking
Auto-redacts passwords, tokens, API keys, credit cards, SSNs. Add custom patterns too.

Timing & Metrics
Timing deltas between logs, operation timers, error rates, and throughput tracking.

Parsed Stack Traces
App code highlighted, node_modules collapsed. Copy or expand with one click.

Alerts & Webhooks
Get notified on error spikes, pattern matches, or slow operations.

Framework Integration

NestJS

// main.ts
import 'dev-log-monitor/auto';
import { NestFactory } from '@nestjs/core';
import { devLogger, DevLogContextInterceptor } from 'dev-log-monitor';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    logger: devLogger.nest(),
  });
  app.useGlobalInterceptors(new DevLogContextInterceptor());
  await app.listen(3000);
}
bootstrap();

Use in services:

import { Injectable } from '@nestjs/common';
import { devLogger } from 'dev-log-monitor';

@Injectable()
export class UserService {
  private logger = devLogger.create('UserService');

  async createUser(data: CreateUserDto) {
    this.logger.info('Creating user', { email: data.email });
  }
}

Express

import 'dev-log-monitor/auto';
import express from 'express';
import { expressContextMiddleware } from 'dev-log-monitor';

const app = express();
app.use(expressContextMiddleware());

app.get('/api/users', (req, res) => {
  console.log('Fetching users');  // Automatically captured!
  res.json({ users: [] });
});

app.listen(3000);

Winston / Pino / Bunyan

import 'dev-log-monitor/auto';
import { wrapLogger } from 'dev-log-monitor';

// Winston
import winston from 'winston';
const winstonLogger = winston.createLogger({ level: 'info', transports: [new winston.transports.Console()] });
const logger = wrapLogger(winstonLogger, 'winston');

// Pino
import pino from 'pino';
const pinoLogger = wrapLogger(pino(), 'pino');

// Bunyan
import bunyan from 'bunyan';
const bunyanLogger = wrapLogger(bunyan.createLogger({ name: 'myapp' }), 'bunyan');

Plain Node.js

import 'dev-log-monitor/auto';

// All console calls are now captured
console.log('Application started');
console.warn('Cache miss', { key: 'user:123' });
console.error('Database connection failed');

// Or use the devLogger directly
import { devLogger } from 'dev-log-monitor';
devLogger.info('Direct log', { data: 'value' });

Configuration

All config via environment variables - no config files needed:

VariableDefaultDescription
DEV_LOG_PORT3333Web UI port
DEV_LOG_DIR.dev-logLog storage directory
DEV_LOG_RETENTION3Days to keep logs
DEV_LOG_CONSOLEtrueAlso print to console
DEV_LOG_INTERCEPTtrueIntercept console.log calls
DEV_LOG_MASKINGtrueAuto-mask sensitive data
DEV_LOG_STORAGE_LEVELdebugMinimum level to persist
DEV_LOG_DISABLEfalseDisable entirely

Or configure programmatically:

import { autoInit } from 'dev-log-monitor';

await autoInit({
  port: 3333,
  logDir: '.dev-log',
  retentionDays: 3,
  consoleOutput: true,
  interceptConsole: true,
  storageLevel: 'debug',
  maxFileSize: 50 * 1024 * 1024,
  maxTotalSize: 100 * 1024 * 1024,
});

Web UI

Open http://localhost:3333 after adding the import.

Keyboard Shortcuts:

KeyActionKeyAction
/Focus searchtToggle theme
j/kNext/prev logmToggle metrics
EnterExpand/collapseeExport logs
1-4Filter by levelcClear logs
?Show shortcutsEscClose/clear

Error details show source location, breadcrumbs (last 10 logs before the error), and parsed stack traces with your app code highlighted.

Request Context & Correlation

import { asyncContext, getTraceId } from 'dev-log-monitor';

asyncContext.run(() => {
  console.log('Start processing');  // auto-assigned traceId
  someAsyncOperation().then(() => {
    console.log('Done processing');  // same traceId
  });
}, { method: 'GET', path: '/api/users' });

Alerting

import { addAlertRule, addWebhook } from 'dev-log-monitor';

addWebhook('slack', { url: 'https://hooks.slack.com/services/xxx', method: 'POST' });

addAlertRule({
  id: 'high-error-rate',
  name: 'High Error Rate',
  condition: { type: 'error_rate', threshold: 5 },
  handlers: ['webhook:slack', 'console'],
  cooldownMs: 60_000,
});

Sensitive Data Masking

import { configureMasking } from 'dev-log-monitor';

configureMasking({
  enabled: true,
  sensitiveKeys: ['myCustomSecret'],
  customPatterns: [
    { name: 'order-id', pattern: /ORDER-\d{6,}/g, replacement: 'ORDER-[REDACTED]' },
  ],
  fullMask: false,
  maskChar: '*',
});

Built-in: password, token, apiKey, authorization, ssn, creditCard, cvv, pin, and 50+ more.

API Reference

Auto-Integration
ExportDescription
import 'dev-log-monitor/auto'One-line auto-integration
autoInit(config)Configure and initialize manually
configureMasking(options)Configure sensitive data masking
wrapLogger(logger, type?)Wrap existing logger
asyncContextRequest context manager
getTraceId()Get current trace ID
getRequestId()Get current request ID
expressContextMiddleware()Express middleware for context
DevLogContextInterceptorNestJS interceptor for context
Alerting
ExportDescription
addAlertRule(rule)Add custom alert rule
addWebhook(name, config)Add named webhook endpoint
configureAlerts(config)Configure alerts with rules and webhooks
Metrics
ExportDescription
getMetrics()Get current metrics snapshot
onMetricsUpdate(callback)Subscribe to metrics updates (returns unsubscribe fn)
Core Logger
MethodDescription
devLogger.init(config?)Initialize manually (not needed with /auto)
devLogger.debug(message, metadata?)Log debug message
devLogger.info(message, metadata?)Log info message
devLogger.warn(message, metadata?)Log warning message
devLogger.error(message, metadata?)Log error message
devLogger.create(context, source?)Create scoped logger
devLogger.nest()Get NestJS adapter
devLogger.express()Get Express middleware
devLogger.shutdown()Gracefully shutdown
Scoped Logger
MethodDescription
logger.debug(message, metadata?)Log debug with context
logger.info(message, metadata?)Log info with context
logger.warn(message, metadata?)Log warning with context
logger.error(message, metadata?)Log error with context
logger.startTimer(operation)Start operation timer

CLI

npx dev-log-monitor clear    # Clear all logs
npx dev-log-monitor status   # Show storage status
npx dev-log-monitor help     # Help

Log Storage

Logs are stored in .dev-log/ in JSONL format, named by date (logs-YYYY-MM-DD.jsonl).

Add to .gitignore:

.dev-log/

Requirements

  • Node.js >= 18.0.0
  • TypeScript optional, but recommended
  • Peer deps (optional): @nestjs/common >= 9.0.0, express >= 4.0.0

License

MIT

Contributing

Contributions are welcome! Please open an issue or submit a pull request at GitHub.

Keywords

logging

FAQs

Package last updated on 27 Feb 2026

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