Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-12-17 08:29:03 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-12-17 08:29:03 +0300
commitbf5b7e61a18c7030db396e7b555d71271fcfc8a8 (patch)
treea934ca7cfa70b9af451add45fd98aca1fdf9a80e
parent524565eb40d8c20080d345be80610ccdea11d8af (diff)
#6622 Logger refactoring: remove INI options:
- log_only_when_cli - log_only_when_debug_parameter
-rw-r--r--CHANGELOG.md1
-rw-r--r--config/global.php15
-rw-r--r--core/Log.php52
3 files changed, 4 insertions, 64 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 809780082d..e9fd4da13e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
* `Log.formatScreenMessage`
* These events where very specific events for an internal need (logging exceptions) and have been replaced by a more extensible solution.
* The event `Log.getAvailableWriters` has been removed: to add custom log backends, you now need to configure Monolog handlers
+* The INI options `log_only_when_cli` and `log_only_when_debug_parameter` have been removed
### Deprecations
* The API method `UserSettings.getBrowserVersion` is deprecated and will be removed from May 1st 2015. Use `DevicesDetection.getBrowserVersions` instead
diff --git a/config/global.php b/config/global.php
index a8aa44565a..7033dbb835 100644
--- a/config/global.php
+++ b/config/global.php
@@ -2,7 +2,6 @@
use Interop\Container\ContainerInterface;
use Monolog\Logger;
-use Piwik\Common;
use Piwik\Log;
use Piwik\Cache\Eager;
use Piwik\SettingsServer;
@@ -117,9 +116,6 @@ return array(
->constructor(DI\link('log.level'))
->method('setFormatter', DI\link('Piwik\Log\Formatter\LineMessageFormatter')),
'log.level' => DI\factory(function (ContainerInterface $c) {
- if ($c->get('log.disabled')) {
- return Log::getMonologLevel(Log::NONE);
- }
if ($c->has('old_config.log.log_level')) {
$level = strtoupper($c->get('old_config.log.log_level'));
if (!empty($level) && defined('Piwik\Log::'.strtoupper($level))) {
@@ -128,17 +124,6 @@ return array(
}
return Logger::WARNING;
}),
- 'log.disabled' => DI\factory(function (ContainerInterface $c) {
- $logOnlyCli = $c->has('old_config.log.log_only_when_cli') ? $c->get('old_config.log.log_only_when_cli') : false;
- if ($logOnlyCli && !Common::isPhpCliMode()) {
- return true;
- }
- $logOnlyWhenDebugParameter = $c->has('old_config.log.log_only_when_debug_parameter') ? $c->get('old_config.log.log_only_when_debug_parameter') : false;
- if ($logOnlyWhenDebugParameter && !isset($_REQUEST['debug'])) {
- return true;
- }
- return false;
- }),
'log.file.filename' => DI\factory(function (ContainerInterface $c) {
$logPath = $c->get('old_config.log.logger_file_path');
diff --git a/core/Log.php b/core/Log.php
index e6c6d22579..afbe2c46f5 100644
--- a/core/Log.php
+++ b/core/Log.php
@@ -20,9 +20,7 @@ use Psr\Log\LoggerInterface;
* the name of the current class is used.
*
* You can log messages using one of the public static functions (eg, 'error', 'warning',
- * 'info', etc.). Messages logged with the **error** level will **always** be logged to
- * the screen, regardless of whether the [log] log_writer config option includes the
- * screen writer.
+ * 'info', etc.).
*
* Currently, Piwik supports the following logging backends:
*
@@ -30,6 +28,8 @@ use Psr\Log\LoggerInterface;
* - **file**: logging to a file
* - **database**: logging to Piwik's MySQL database
*
+ * Messages logged in the console will always be logged to the console output.
+ *
* ### Logging configuration
*
* The logging utility can be configured by manipulating the INI config options in the
@@ -44,57 +44,11 @@ use Psr\Log\LoggerInterface;
* or **VERBOSE**. Log entries made with a log level that is as or more
* severe than the current log level will be outputted. Others will be
* ignored. The default level is **WARN**.
- * - `log_only_when_cli`: 0 or 1. If 1, logging is only enabled when Piwik is executed
- * in the command line (for example, by the core:archive command
- * script). Default: 0.
- * - `log_only_when_debug_parameter`: 0 or 1. If 1, logging is only enabled when the
- * `debug` query parameter is 1. Default: 0.
* - `logger_file_path`: For the file log writer, specifies the path to the log file
* to log to or a path to a directory to store logs in. If a
* directory, the file name is piwik.log. Can be relative to
* Piwik's root dir or an absolute path. Defaults to **tmp/logs**.
*
- * ### Custom message formatting
- *
- * If you'd like to format log messages differently for different backends, you can
- * implement a new `Piwik\Log\Formatter\Formatter`.
- *
- * If you don't care about the backend when formatting an object, implement a `__toString()`
- * in the custom class.
- *
- * ### Custom log writers
- *
- * New logging backends can be added via the {@hook Log.getAvailableWriters}` event. A log
- * writer is just a callback that accepts log entry information (such as the message,
- * level, etc.), so any backend could conceivably be used (including existing PSR3
- * backends).
- *
- * ### Examples
- *
- * **Basic logging**
- *
- * Log::error("This log message will end up on the screen and in a file.")
- * Log::verbose("This log message uses %s params, but %s will only be called if the"
- * . " configured log level includes %s.", "sprintf", "sprintf", "verbose");
- *
- * **Logging objects**
- *
- * class MyDebugInfo
- * {
- * // ...
- *
- * public function __toString()
- * {
- * return // ...
- * }
- * }
- *
- * try {
- * $myThirdPartyServiceClient->doSomething();
- * } catch (Exception $unexpectedError) {
- * $debugInfo = new MyDebugInfo($unexpectedError, $myThirdPartyServiceClient);
- * Log::debug($debugInfo);
- * }
*
* @deprecated Inject and use Psr\Log\LoggerInterface instead of this class.
* @see \Psr\Log\LoggerInterface