📜  注入多个记录器 symfony - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:50.030000             🧑  作者: Mango

代码示例1
# App/Subscribers/WebhookLoggingListener.php file
public function __construct(
    LoggerInterface $logger, 
    LoggerInterface $mailgunLog, 
    LoggerInterface $dripLog) {
}

# services.yml
App\Subscribers\WebhookLoggingListener:
    arguments:
        $logger: "@logger"
        $mailgunLog: "@monolog.logger.mailgun"
        $dripLog: "@monolog.logger.drip"
    tags:
       - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }