kuborgh/symfony-traits

A collection of traits to inject symfony services

dev-master 2016-06-15 14:59 UTC

This package is not auto-updated.

Last update: 2024-03-16 16:18:44 UTC


README

Collection of traits to inject common symfony services

Usage

Logger

use LoggerTrait;
...
try {
    doSomeStuff($id);
} catch (\Exception $exc) {
    // Log Exception text and type in context
    $logCtx = $this->logContextFromException($exc);
    // Add additional specific context
    $logCtx['id'] = $id;
    // Log away
    $this->logError('Error in doing some stuff', $logCtx);
}