lib/index.js
/**
 * The appender function.
 *
 * @param {String} dsn The Sentry URL to post events to.
 * @param {String} layout The layout to use to format the message.
 * @param {String} level The log level to use as an override for the main category level.
 *
 * @return {Function} Returns the
 */
The appender function.
@param {String} dsn The Sentry URL to post events to.
@param {String} layout The layout to use to format the message.
@param {String} level The log level to use as an override for the main category level.

@return {Function} Returns the
The appender function . @param { String } dsn The Sentry URL to post events to . @param { String } layout The layout to use to format the message . @param { String } level The log level to use as an override for the main category level . @return { Function } Returns the
function sentryAppender(client, layout, level) {
  layout = layout || layouts.messagePassThroughLayout;
    return function(logEvent) {
      if (level && !logEvent.level.isGreaterThanOrEqualTo(level)) return;
      var message = layout(logEvent);
      var kwargs = {};
      kwargs.level = levelMapping[logEvent.level.toString().toLowerCase()];
      kwargs.logger = logEvent.categoryName;
      var data = logEvent.data;
      if (data.length > 1) {
        kwargs.logentry = {
          message: data[0],
          params: data.slice(1)
        };
      }
      var errors = data.filter(function(item) {
        return item instanceof Error;
      });
      active++;
      if (errors.length) {
        kwargs.message = message;
        client.captureException(errors[0], kwargs);
      } else {
        client.captureMessage(message, kwargs);
      }
    };
}
function sentryAppender ( client , layout , level ) { layout = layout || layouts . messagePassThroughLayout ; return function ( logEvent ) { if ( level && ! logEvent . level . isGreaterThanOrEqualTo ( level ) ) return ; var message = layout ( logEvent ) ; var kwargs = { } ; kwargs . level = levelMapping [ logEvent . level . toString ( ) . toLowerCase ( ) ] ; kwargs . logger = logEvent . categoryName ; var data = logEvent . data ; if ( data . length > 1 ) { kwargs . logentry = { message : data [ 0 ] , params : data . slice ( 1 ) } ; } var errors = data . filter ( function ( item ) { return item instanceof Error ; } ) ; active ++ ; if ( errors . length ) { kwargs . message = message ; client . captureException ( errors [ 0 ] , kwargs ) ; } else { client . captureMessage ( message , kwargs ) ; } } ; }
The appender function.
The appender function .
// Check if the log level is enabled // Format the log message