skowronline/user-processor-bundle

Monolog process which adds user to log message

v1.0.0 2017-01-04 12:40 UTC

This package is not auto-updated.

Last update: 2024-09-18 19:09:07 UTC


README

Scrutinizer Code Quality Build Status Code Coverage SensioLabsInsight

Install

composer require skowronline/user-processor-bundle

# config.yml
imports:
    ...
    - { resource: "@SkowronlineUserProcessorBundle/Resources/config/services.yml" }

Usage

custom.stream.handler:
    class: Monolog\Handler\StreamHandler
    arguments: ["%kernel.logs_dir%/custom.log"]
    public: false
custom.logger:
    class: Symfony\Bridge\Monolog\Logger
    arguments: [symfony, ['@custom.stream.handler'], ['@skowronline.monolog.user.processor']]
$this->get('custom.logger')->info('Custom message');
[2016-05-21 10:26:47] symfony.INFO: Custom message [] {"user":"anon."}

Global usage

You have to override service definition and add monolog.processor tag

skowronline.monolog.user.processor.global:
	parent: skowronline.monolog.user.processor
	tags:
	  - { name: monolog.processor }