SAREhub/php_component_worker

View on GitHub
src/SAREhub/Component/Worker/Logger/WorkerIdProcessor.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace SAREhub\Component\Worker\Logger;

/**
 * Processor for monolog logging, adds WorkerId to log records.
 */
class WorkerIdProcessor {
    
    private $workerId;
    
    public function __construct($workerId) {
        $this->workerId = $workerId;
    }
    
    public function __invoke($record) {
        $record['extra']['workerId'] = $this->workerId;
        return $record;
    }
}