jacobemerick / monolog-pqp
Monolog handler that interfaces with PHP Quick Profiler
Requires
- php: >=5.3.0
- monolog/monolog: ^1.17
- particletree/pqp: ^1.0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: ^4.7
- symfony/config: <3.0
- symfony/console: <3.0
- symfony/filesystem: <3.0
- symfony/stopwatch: <3.0
- symfony/yaml: <3.0
This package is not auto-updated.
Last update: 2024-11-09 19:40:17 UTC
README
Monolog handler that interfaces with PHP Quick Profiler
Installation
It's recommended that you use Composer to install MonologPQP Handler.
$ composer require jacobemerick/monolog-pqp
This will install the handler and dependencies. It requires PHP 5.3.0 or newer.
Usage
This is a handler for Monolog that will send logs and exceptions to PHP Quick Profiler. For more information about the profiler see jacobemerick/pqp.
$console = new Particletree\Pqp\Console(); $profiler = new Particletree\Pqp\PhpQuickProfiler(); $profiler->setConsole(); $logger = new Monolog\Logger('web'); $handler = new Jacobemerick\MonologPqp\PqpHandler($console); $logger->pushHandler($handler); $logger->addDebug('PQP handler added to Monolog');
The default logging level for this handler is set to Monolog\Logger::DEBUG
. For more information about this, or how to customize the format displayed in the profiler, see Seldaek/monolog.
Errors
PHP Quick Profiler handles exceptions separately, displaying more information about them and tagging as 'error'. If you simply do $logger->error()
you will log the message but not get the extra sugar. The best way to handle this is by using Monolog as an exception handler.
$logger = new Monolog\Logger('web'); $handler = new Jacobemerick\MonologPqp\PqpHandler($console); $logger->pushHandler($handler); Monolog\ErrorHandler::register($logger); throw new Exception('testing');
This will trigger the logError
method in the profiler and display additional data about the problem.