InsightHub - viames/pair GitHub Wiki

Pair framework: InsightHub

Pair\Services\InsightHub sends errors, exceptions, warnings, and info messages to Insight Hub (Bugsnag-based integration).

When to use

Use it when you want external error monitoring and incident visibility across environments.

Main methods

  • error(string $name, string $message): void
  • warning(string $name, string $message): void
  • info(string $name, string $message): void
  • exception(Throwable $exception, string $severity = 'error'): void
  • handle(string $message, int $phpError): void
  • getSeverity(int $errorType): string

Implementation examples

Business event as info/warning

\Pair\Services\InsightHub::info('OrderExported', 'Order #2241 exported');
\Pair\Services\InsightHub::warning('SlowGateway', 'Gateway response > 4s');

Exception reporting

try {
    (new BillingService())->charge($order);
} catch (\Throwable $e) {
    \Pair\Services\InsightHub::exception($e, 'error');
    throw $e;
}

Common pitfalls

  • Missing INSIGHT_HUB_API_KEY disables reporting.
  • Exception grouping quality depends on consistent error naming.

See also: ElkLogger, ErrorLog, Report.