You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [Taxi service sample](https://github.com/butschster/podlodka-taxi-service)
333
335
336
+
## Logging
337
+
338
+
The RoadRunner PSR Logger provides PSR-3 compatible logging with RoadRunner integration. The logger uses RPC calls to send logs to RoadRunner's centralized logging system, providing proper log level control and structured context support.
339
+
340
+
### Usage
341
+
342
+
The RoadRunner PSR Logger is available throughout your application via dependency injection:
343
+
344
+
#### Dependency Injection (Recommended)
345
+
346
+
```php
347
+
use Psr\Log\LoggerInterface;
348
+
349
+
class YourService
350
+
{
351
+
public function __construct(
352
+
private LoggerInterface $logger
353
+
) {}
354
+
355
+
public function doSomething()
356
+
{
357
+
$this->logger->info('Operation started');
358
+
359
+
try {
360
+
// Your logic here
361
+
$this->logger->info('Operation completed');
362
+
} catch (\Exception $e) {
363
+
$this->logger->error('Operation failed', [
364
+
'exception' => $e->getMessage(),
365
+
'trace' => $e->getTraceAsString()
366
+
]);
367
+
}
368
+
}
369
+
}
370
+
```
371
+
372
+
#### Service Container Resolution
373
+
374
+
```php
375
+
// Get logger from container
376
+
$logger = app(LoggerInterface::class);
377
+
// Or using the alias
378
+
$logger = app('roadrunner.logger');
379
+
380
+
$logger->info('Message', ['context' => 'data']);
381
+
```
382
+
383
+
#### Useful Links
384
+
- [RoadRunner PSR Logger](https://github.com/roadrunner-php/psr-logger)
385
+
334
386
## Custom Workers
335
387
336
388
The RoadRunner Laravel Bridge comes with several predefined workers for common plugins,
0 commit comments