diff options
-rw-r--r-- | composer.json | 5 | ||||
-rw-r--r-- | composer.lock | 245 | ||||
-rw-r--r-- | core/Log/Formatter/AddRequestIdFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/ErrorHtmlFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/ErrorTextFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/ExceptionHtmlFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/ExceptionTextFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/Formatter.php | 26 | ||||
-rw-r--r-- | core/Log/Formatter/HtmlPreFormatter.php | 4 | ||||
-rw-r--r-- | core/Log/Formatter/LineMessageFormatter.php | 4 |
10 files changed, 244 insertions, 60 deletions
diff --git a/composer.json b/composer.json index 91fffba957..6194fcb47a 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,10 @@ "piwik/device-detector": "~2.0", "piwik/decompress": "~0.1.1", "piwik/network": "~0.1.0", - "mnapoli/php-di": "5.0.x-dev" + "mnapoli/php-di": "5.0.x-dev", + "psr/log": "~1.0", + "monolog/monolog": "~1.11", + "symfony/monolog-bridge": "~2.5" }, "require-dev": { "aws/aws-sdk-php": "2.7.1", diff --git a/composer.lock b/composer.lock index 35c4ed5a40..74774d1b5d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "92499fc432a629fefcd5c1b912e44d9c", + "hash": "ed64c8df41ea550e2c0b78424573310e", "packages": [ { "name": "container-interop/container-interop", @@ -355,6 +355,78 @@ "time": "2014-08-21 08:20:45" }, { + "name": "monolog/monolog", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/ec3961874c43840e96da3a8a1ed20d8c73d7e5aa", + "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "~2.4, >2.4.8", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "phpunit/phpunit": "~3.7.0", + "raven/raven": "~0.5", + "ruflin/elastica": "0.90.*", + "videlalvaro/php-amqplib": "~2.4" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2014-09-30 13:30:58" + }, + { "name": "mustangostang/spyc", "version": "0.5.1", "source": { @@ -469,16 +541,16 @@ }, { "name": "piwik/device-detector", - "version": "2.6", + "version": "2.7", "source": { "type": "git", "url": "https://github.com/piwik/device-detector.git", - "reference": "60831e80b45d296e19b07cde198fe8dff7311bec" + "reference": "a76f214f01054d102352b9e4045491460c19d78a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/piwik/device-detector/zipball/60831e80b45d296e19b07cde198fe8dff7311bec", - "reference": "60831e80b45d296e19b07cde198fe8dff7311bec", + "url": "https://api.github.com/repos/piwik/device-detector/zipball/a76f214f01054d102352b9e4045491460c19d78a", + "reference": "a76f214f01054d102352b9e4045491460c19d78a", "shasum": "" }, "require": { @@ -512,7 +584,7 @@ "parser", "useragent" ], - "time": "2014-10-30 13:45:01" + "time": "2014-11-25 21:41:24" }, { "name": "piwik/network", @@ -547,18 +619,56 @@ "time": "2014-10-23 03:30:23" }, { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" + }, + { "name": "symfony/console", - "version": "v2.5.6", + "version": "v2.6.0", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0" + "reference": "d3bac228fd7a2aac9193e241b239880b3ba39a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/6f177fca24200a5b97aef5ce7a5c98124a0f0db0", - "reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0", + "url": "https://api.github.com/repos/symfony/Console/zipball/d3bac228fd7a2aac9193e241b239880b3ba39a10", + "reference": "d3bac228fd7a2aac9193e241b239880b3ba39a10", "shasum": "" }, "require": { @@ -566,16 +676,18 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1" + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", - "symfony/event-dispatcher": "" + "symfony/event-dispatcher": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -599,7 +711,65 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-10-05 13:57:04" + "time": "2014-11-20 13:24:23" + }, + { + "name": "symfony/monolog-bridge", + "version": "v2.6.0", + "target-dir": "Symfony/Bridge/Monolog", + "source": { + "type": "git", + "url": "https://github.com/symfony/MonologBridge.git", + "reference": "2ac99fc4a9846faf12152a61c3355f1041db881c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/MonologBridge/zipball/2ac99fc4a9846faf12152a61c3355f1041db881c", + "reference": "2ac99fc4a9846faf12152a61c3355f1041db881c", + "shasum": "" + }, + "require": { + "monolog/monolog": "~1.11", + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/console": "~2.3", + "symfony/event-dispatcher": "~2.2", + "symfony/http-kernel": "~2.2" + }, + "suggest": { + "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", + "symfony/event-dispatcher": "Needed when using log messages in console commands", + "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel." + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Bridge\\Monolog\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Monolog Bridge", + "homepage": "http://symfony.com", + "time": "2014-11-28 10:00:40" }, { "name": "tedivm/jshrink", @@ -945,16 +1115,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "0.3.8", + "version": "0.3.9", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "5085202f1f37769aae59f9711c423f28159c9b29" + "reference": "c6e88ca6e81bc5a2d7161658e16a95b7ef8d6ad1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/5085202f1f37769aae59f9711c423f28159c9b29", - "reference": "5085202f1f37769aae59f9711c423f28159c9b29", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c6e88ca6e81bc5a2d7161658e16a95b7ef8d6ad1", + "reference": "c6e88ca6e81bc5a2d7161658e16a95b7ef8d6ad1", "shasum": "" }, "require": { @@ -1039,7 +1209,7 @@ "x.509", "x509" ], - "time": "2014-09-13 02:42:45" + "time": "2014-11-10 03:08:59" }, { "name": "phpunit/php-code-coverage", @@ -1290,16 +1460,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.3.4", + "version": "4.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "23e4e0310f037aae873cc81b8658dbbb82878f71" + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/23e4e0310f037aae873cc81b8658dbbb82878f71", - "reference": "23e4e0310f037aae873cc81b8658dbbb82878f71", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", "shasum": "" }, "require": { @@ -1360,7 +1530,7 @@ "testing", "xunit" ], - "time": "2014-10-22 11:43:12" + "time": "2014-11-11 10:11:09" }, { "name": "phpunit/phpunit-mock-objects", @@ -1685,17 +1855,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.5.6", + "version": "v2.6.0", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212" + "reference": "697331d4ac78668cf6d21a2bb009b3faae92814f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/804eb28dbbfba9ffdab21fe2066744906cea2212", - "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/697331d4ac78668cf6d21a2bb009b3faae92814f", + "reference": "697331d4ac78668cf6d21a2bb009b3faae92814f", "shasum": "" }, "require": { @@ -1704,7 +1874,8 @@ "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.0,<2.6.0", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", "symfony/stopwatch": "~2.2" }, "suggest": { @@ -1714,7 +1885,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -1738,21 +1909,21 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2014-10-01 15:43:05" + "time": "2014-11-28 10:00:40" }, { "name": "symfony/yaml", - "version": "v2.5.6", + "version": "v2.6.0", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726" + "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/2d9f527449cabfa8543dd7fa3a466d6ae83d6726", - "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", + "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", "shasum": "" }, "require": { @@ -1761,7 +1932,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -1785,7 +1956,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-10-01 05:50:18" + "time": "2014-11-20 13:24:23" } ], "aliases": [], diff --git a/core/Log/Formatter/AddRequestIdFormatter.php b/core/Log/Formatter/AddRequestIdFormatter.php index 3de87af71f..9d027f5886 100644 --- a/core/Log/Formatter/AddRequestIdFormatter.php +++ b/core/Log/Formatter/AddRequestIdFormatter.php @@ -16,7 +16,7 @@ use Piwik\Log; */ class AddRequestIdFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { static $currentRequestKey; @@ -24,7 +24,7 @@ class AddRequestIdFormatter extends Formatter $currentRequestKey = substr(Common::generateUniqId(), 0, 5); } - $record = $this->next($record, $logger); + $record = $this->next($record); if (! is_string($record['message'])) { return $record; diff --git a/core/Log/Formatter/ErrorHtmlFormatter.php b/core/Log/Formatter/ErrorHtmlFormatter.php index f499df9b10..6b4bbe3ba3 100644 --- a/core/Log/Formatter/ErrorHtmlFormatter.php +++ b/core/Log/Formatter/ErrorHtmlFormatter.php @@ -18,12 +18,12 @@ use Piwik\Version; */ class ErrorHtmlFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { $message = $record['message']; if (! $message instanceof Error) { - return $this->next($record, $logger); + return $this->next($record); } $errno = $message->errno & error_reporting(); diff --git a/core/Log/Formatter/ErrorTextFormatter.php b/core/Log/Formatter/ErrorTextFormatter.php index e2651ad638..a4df5990e8 100644 --- a/core/Log/Formatter/ErrorTextFormatter.php +++ b/core/Log/Formatter/ErrorTextFormatter.php @@ -16,7 +16,7 @@ use Piwik\Log; */ class ErrorTextFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { $message = $record['message']; @@ -25,6 +25,6 @@ class ErrorTextFormatter extends Formatter . ' - ' . $message->errstr . "\n" . $message->backtrace; } - return $this->next($record, $logger); + return $this->next($record); } } diff --git a/core/Log/Formatter/ExceptionHtmlFormatter.php b/core/Log/Formatter/ExceptionHtmlFormatter.php index 5be62bcb67..70549dbd7e 100644 --- a/core/Log/Formatter/ExceptionHtmlFormatter.php +++ b/core/Log/Formatter/ExceptionHtmlFormatter.php @@ -17,10 +17,10 @@ use Piwik\Log; */ class ExceptionHtmlFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { if (! $record['message'] instanceof \Exception) { - return $this->next($record, $logger); + return $this->next($record); } Common::sendHeader('Content-Type: text/html; charset=utf-8'); diff --git a/core/Log/Formatter/ExceptionTextFormatter.php b/core/Log/Formatter/ExceptionTextFormatter.php index 1e0bd0ed12..62b850f443 100644 --- a/core/Log/Formatter/ExceptionTextFormatter.php +++ b/core/Log/Formatter/ExceptionTextFormatter.php @@ -16,7 +16,7 @@ use Piwik\Log; */ class ExceptionTextFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { $message = $record['message']; @@ -25,6 +25,6 @@ class ExceptionTextFormatter extends Formatter ExceptionHandler::$debugBacktraceForTests ?: $message->getTraceAsString()); } - return $this->next($record, $logger); + return $this->next($record); } } diff --git a/core/Log/Formatter/Formatter.php b/core/Log/Formatter/Formatter.php index 66de41423c..264a393991 100644 --- a/core/Log/Formatter/Formatter.php +++ b/core/Log/Formatter/Formatter.php @@ -8,6 +8,7 @@ namespace Piwik\Log\Formatter; +use Monolog\Formatter\FormatterInterface; use Piwik\Log; /** @@ -16,7 +17,7 @@ use Piwik\Log; * Follows the Chain of responsibility design pattern, so don't forget to call `$this->next(...)` * at the end of the `format()` method. */ -abstract class Formatter +abstract class Formatter implements FormatterInterface { /** * @var Formatter|null @@ -24,12 +25,21 @@ abstract class Formatter protected $next; /** - * @param array $record - * @param Log $logger - * - * @return array Updated record. + * {@inheritdoc} + */ + public abstract function format(array $record); + + /** + * {@inheritdoc} */ - public abstract function format(array $record, Log $logger); + public function formatBatch(array $records) + { + foreach ($records as $key => $record) { + $records[$key] = $this->format($record); + } + + return $records; + } /** * Chain of responsibility pattern. @@ -41,12 +51,12 @@ abstract class Formatter $this->next = $formatter; } - protected function next(array $record, Log $logger) + protected function next(array $record) { if (! $this->next) { return $record; } - return $this->next->format($record, $logger); + return $this->next->format($record); } } diff --git a/core/Log/Formatter/HtmlPreFormatter.php b/core/Log/Formatter/HtmlPreFormatter.php index ecc52fc149..878304e8fa 100644 --- a/core/Log/Formatter/HtmlPreFormatter.php +++ b/core/Log/Formatter/HtmlPreFormatter.php @@ -16,9 +16,9 @@ use Piwik\Log; */ class HtmlPreFormatter extends Formatter { - public function format(array $record, Log $logger) + public function format(array $record) { - $record = $this->next($record, $logger); + $record = $this->next($record); if (! is_string($record['message'])) { return $record; diff --git a/core/Log/Formatter/LineMessageFormatter.php b/core/Log/Formatter/LineMessageFormatter.php index 4b778f858a..14096ce7ac 100644 --- a/core/Log/Formatter/LineMessageFormatter.php +++ b/core/Log/Formatter/LineMessageFormatter.php @@ -28,7 +28,7 @@ class LineMessageFormatter extends Formatter $this->logMessageFormat = $logMessageFormat; } - public function format(array $record, Log $logger) + public function format(array $record) { if (! is_string($record['message'])) { throw new \InvalidArgumentException('Trying to log a message that is not a string'); @@ -40,6 +40,6 @@ class LineMessageFormatter extends Formatter $this->logMessageFormat ); - return $this->next($record, $logger); + return $this->next($record); } } |