Log - viames/pair GitHub Wiki
Pair framework: Log
Pair\Helpers\Log is the central static logging helper used across Pair.
When to use
Use Log when you need framework-level logs from controllers, models, services, jobs, or integrations.
Main methods
Common levels are exposed as static methods in the helper (for example debug, info, warning, error) and accept a message plus optional context.
Implementation examples
Basic usage
\Pair\Helpers\Log::info('Order imported', ['orderId' => 2241]);
\Pair\Helpers\Log::warning('Gateway latency high', ['provider' => 'stripe']);
Service-level flow
final class BillingSyncService {
public function run(int $invoiceId): void
{
\Pair\Helpers\Log::debug('Billing sync started', ['invoiceId' => $invoiceId]);
try {
// sync logic
\Pair\Helpers\Log::info('Billing sync completed', ['invoiceId' => $invoiceId]);
} catch (\Throwable $e) {
\Pair\Helpers\Log::error('Billing sync failed', [
'invoiceId' => $invoiceId,
'exception' => $e->getMessage()
]);
throw $e;
}
}
}
Common pitfalls
- Logging only plain strings without context makes diagnostics harder.
- Logging sensitive data (tokens, passwords, full card data) must be avoided.