Severity Levels

Capture events at different severity levels to categorize and prioritize issues.

Available Levels

DEBUGDevelopment and debugging information
INFOGeneral information and events
WARNINGPotential issues that should be monitored
ERRORErrors that need attention (default)
FATALCritical failures requiring immediate action

Capture Functions

import { 
  captureDebug, 
  captureInfo, 
  captureWarning, 
  captureError, 
  captureFatal 
} from 'errormail';

// Debug message
captureDebug('Starting sync process', { syncId: 'abc123' });

// Info message
captureInfo('User completed onboarding', { userId: 123 });

// Warning
captureWarning('API response slow', { responseTime: 3500 });

// Error
captureError(new Error('Failed to save'), { userId: 123 });

// Fatal
captureFatal(new Error('Database connection lost'));

Custom Level

import { captureMessage, ErrorLevel } from 'errormail';

// Capture with custom level
captureMessage('Custom event', ErrorLevel.INFO, { 
  customData: 'value' 
});

With Function Wrappers

import { errormail, ErrorLevel } from 'errormail';

// Set severity level for wrapped functions
const safeFn = errormail(myFunction, {
  emailTo: 'admin@example.com',
  level: ErrorLevel.FATAL
});