New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

log-process-errors

Package Overview
Dependencies
Maintainers
1
Versions
86
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.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
139K
increased by13.19%
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

FAQs

Package last updated on 28 Oct 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc