🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

log-process-errors

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-process-errors

Show some ❤️ to process errors

12.0.1
latest
Source
npm
Version published
Weekly downloads
136K
-21.16%
Maintainers
1
Weekly downloads
 
Created

What is log-process-errors?

The log-process-errors npm package is designed to automatically log and handle process errors in Node.js applications. It provides a simple and consistent way to manage errors such as uncaught exceptions, unhandled promise rejections, and other process-level errors, making debugging and monitoring easier.

What are log-process-errors's main functionalities?

Automatic Error Logging

This feature automatically logs uncaught exceptions, unhandled promise rejections, and other process errors to the console or a specified logging service. By simply requiring and invoking the package, it starts monitoring and logging errors without additional configuration.

const logProcessErrors = require('log-process-errors');
logProcessErrors();

Custom Error Handlers

Allows you to define custom error handlers for different types of process errors. This example shows how to log a custom message for each error event.

const logProcessErrors = require('log-process-errors');
logProcessErrors({
  onError(error, event, originalError) {
    console.error(`Custom handler: ${event} - ${error.message}`);
  }
});

Integration with Logging Services

This feature allows integration with various logging services like Winston, Bunyan, or any other logging library. The example demonstrates how to use Winston to log process errors.

const logProcessErrors = require('log-process-errors');
const winston = require('winston');
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console()
  ]
});
logProcessErrors({
  onError(error, event, originalError) {
    logger.error(`${event} - ${error.message}`);
  }
});

Other packages similar to log-process-errors

Keywords

code-quality

FAQs

Package last updated on 29 Mar 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