Skip to content

Commit

Permalink
#6622 Logger refactoring: renamed "Backend" to "Handler" to match Mon…
Browse files Browse the repository at this point in the history
…olog naming
  • Loading branch information
mnapoli committed Dec 9, 2014
1 parent aad92e9 commit 3fd7de5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 67 deletions.
18 changes: 9 additions & 9 deletions config/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Monolog\Logger;
use Piwik\Common;
use Piwik\Log;
use Piwik\Log\Backend\StdErrBackend;
use Piwik\Log\Handler\StdErrHandler;

return array(

Expand Down Expand Up @@ -38,9 +38,9 @@
}

$classes = array(
'file' => 'Piwik\Log\Backend\FileBackend',
'screen' => 'Piwik\Log\Backend\StdOutBackend',
'database' => 'Piwik\Log\Backend\DatabaseBackend',
'file' => 'Piwik\Log\Handler\FileHandler',
'screen' => 'Piwik\Log\Handler\StdOutHandler',
'database' => 'Piwik\Log\Handler\DatabaseHandler',
);

$writerNames = array_map('trim', $writerNames);
Expand All @@ -52,9 +52,9 @@
}
}

// Always add the stderr backend
// Always add the stderr handler
$isLoggingToStdOut = isset($writers['screen']);
$writers['stderr'] = new StdErrBackend($c->get('Piwik\Log\Formatter\ExceptionHtmlFormatter'), $isLoggingToStdOut);
$writers['stderr'] = new StdErrHandler($c->get('Piwik\Log\Formatter\ExceptionHtmlFormatter'), $isLoggingToStdOut);

return array_values($writers);
}),
Expand All @@ -64,13 +64,13 @@
DI\link('Piwik\Log\Processor\SprintfProcessor'),
DI\link('Monolog\Processor\PsrLogMessageProcessor'),
),
'Piwik\Log\Backend\FileBackend' => DI\object()
'Piwik\Log\Handler\FileHandler' => DI\object()
->constructor(DI\link('log.file.filename'), DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\ExceptionTextFormatter')),
'Piwik\Log\Backend\DatabaseBackend' => DI\object()
'Piwik\Log\Handler\DatabaseHandler' => DI\object()
->constructor(DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\ExceptionTextFormatter')),
'Piwik\Log\Backend\StdOutBackend' => DI\object()
'Piwik\Log\Handler\StdOutHandler' => DI\object()
->constructor(DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\ExceptionHtmlFormatter')),
'log.level' => DI\factory(function (ContainerInterface $c) {
Expand Down
50 changes: 0 additions & 50 deletions core/Log/Backend/Backend.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Log\Backend;
namespace Piwik\Log\Handler;

use Monolog\Handler\AbstractProcessingHandler;
use Piwik\Common;
Expand All @@ -15,7 +15,7 @@
/**
* Writes log to database.
*/
class DatabaseBackend extends AbstractProcessingHandler
class DatabaseHandler extends AbstractProcessingHandler
{
protected function write(array $record)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Log\Backend;
namespace Piwik\Log\Handler;

use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
Expand All @@ -15,7 +15,7 @@
/**
* Writes log to file.
*/
class FileBackend extends AbstractProcessingHandler
class FileHandler extends AbstractProcessingHandler
{
/**
* Path to the file to log to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Log\Backend;
namespace Piwik\Log\Handler;

use Monolog\Formatter\FormatterInterface;
use Monolog\Handler\AbstractProcessingHandler;
Expand All @@ -15,7 +15,7 @@
/**
* Writes log to stderr.
*/
class StdErrBackend extends AbstractProcessingHandler
class StdErrHandler extends AbstractProcessingHandler
{
/**
* @var bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Log\Backend;
namespace Piwik\Log\Handler;

use Monolog\Handler\AbstractProcessingHandler;

/**
* Writes log to stdout.
*/
class StdOutBackend extends AbstractProcessingHandler
class StdOutHandler extends AbstractProcessingHandler
{
protected function write(array $record)
{
Expand Down

0 comments on commit 3fd7de5

Please sign in to comment.