Source of file Logger.php
Size: 2,065 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Proxy/Logger.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Proxy; use Bluz\Common\Nil; use Bluz\Logger\Logger as Instance; /** * Proxy to Logger * * Example of usage * <code> * use Bluz\Proxy\Logger; * * Logger::error('Configuration not found'); * </code> * * @package Bluz\Proxy * @author Anton Shevchuk * * @method static Instance getInstance() * * @method static void alert($message, array $context = []) * @see Instance::alert() * * @method static void critical($message, array $context = []) * @see Instance::critical() * * @method static void debug($message, array $context = []) * @see Instance::debug() * * @method static void emergency($message, array $context = []) * @see Instance::emergency() * * @method static void error($message, array $context = []) * @see Instance::error() * * @method static void info($message, array $context = []) * @see Instance::info() * * @method static void notice($message, array $context = []) * @see Instance::notice() * * @method static void warning($message, array $context = []) * @see Instance::warning() * * @method static void log($level, $message, array $context = []) * @see Instance::log() * * @method static array get($level) * @see Instance::get() */ final class Logger { use ProxyTrait; /** * Init instance * * @return Instance|Nil */ private static function initInstance() { if (Config::getData('logger')) { return new Instance(); } return new Nil(); } /** * exception * * @param \Exception $exception * * @return void */ public static function exception($exception) { self::getInstance()->error( $exception->getMessage() . ' [' . $exception->getFile() . ':' . $exception->getLine() . ']' ); } } |