LogTrait - viames/pair GitHub Wiki
Pair framework: LogTrait
Pair\Traits\LogTrait adds convenient logging methods to classes.
Main methods
log(string $description, string $type = 'notice', string $subtext = ''): voidlogError(string $description, string $subtext = ''): voidlogWarning(string $description, string $subtext = ''): voiddisableLogBar(): void
Implementation example
final class OrderService {
use \Pair\Traits\LogTrait;
public function run(): void {
$this->log('Order sync started');
try {
// business logic
} catch (\Throwable $e) {
$this->logError('Order sync failed', $e->getMessage());
}
}
}
Notes
- Helpful in services/controllers that need structured logs with minimal boilerplate.