2017 © Pedro Peláez
 

library monolog-pqp

Monolog handler that interfaces with PHP Quick Profiler

image

jacobemerick/monolog-pqp

Monolog handler that interfaces with PHP Quick Profiler

  • Thursday, January 14, 2016
  • by jacobemerick
  • Repository
  • 0 Watchers
  • 0 Stars
  • 339 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

monolog-pqp

Build Status Code Climate Test Coverage Scrutinizer Code Quality, (*1)

Monolog handler that interfaces with PHP Quick Profiler, (*2)

Installation

It's recommended that you use Composer to install MonologPQP Handler., (*3)

$ composer require jacobemerick/monolog-pqp

This will install the handler and dependencies. It requires PHP 5.3.0 or newer., (*4)

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., (*5)

$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., (*6)

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., (*7)

$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., (*8)

The Versions

14/01 2016