Skip to content

Latest commit

 

History

History
88 lines (66 loc) · 2.63 KB

readme.md

File metadata and controls

88 lines (66 loc) · 2.63 KB

kucera/monolog-extensions-bundle

Build Status Downloads this Month Latest stable

Bundle providing mainly integration of Tracy into Symfony.

Tracy capabilities

Long story short, Tracy helps you debug your applications when an error occurs providing you lots of information about what just happened. Check out live example and Tracy documentation to see the full power of this tool.

To replace default Symfony Bluescreen you can use Tracy Bluescreen Bundle fully compatible with this library.

Installation

Using Composer:

$ composer require kucera/monolog-extensions-bundle:~0.1.0

Register Bundle

// AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Kucera\MonologExtensionsBundle\KuceraMonologExtensionsBundle(), // what a terrible name!
    );
}

Register a new Monolog handler

monolog:
    handlers:
        blueScreen:
            type: blue screen

Profit!

Any error/exception making it to the top is automatically saved in %kernel.logs_dir%/blueScreen. You can easily change the log directory, see full configuration options below:

# config.yml
monolog:
    handlers:
        blueScreen:
            type: blue screen
            path: %kernel.logs_dir%/blueScreen # must exist
            level: debug
            bubble: true

This works out of the box and also in production mode!

Tips

Log notices/warnings in production

Use Symfony parameter debug.error_handler.throw_at: (see http://php.net/manual/en/function.error-reporting.php for possible values)

parameters:
    debug.error_handler.throw_at: -1

Using Tracy\Debugger::dump

To prevent forgotten dumps to appear on production you can simply change the mode like this:

// AppKernel.php

use Tracy\Debugger;

public function __construct($environment, $debug)
{
    Debugger::$productionMode = $environment === 'prod';
    parent::__construct($environment, $debug);
}