kuborgh/symfony-traits

一组用于注入symfony服务的特性

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

This package is not auto-updated.

Last update: 2024-09-14 18:53:13 UTC


README

一组用于注入常用symfony服务的特性

使用方法

日志记录器

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);
}