diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-10-01 06:23:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 06:23:18 +0300 |
commit | 42a62a21cb5c2df97e0b6fe64ecc2c5ea426f119 (patch) | |
tree | 3f5742d11026dfd9bc6866415630cc492e87f649 /core/Common.php | |
parent | 416697204ae953c4da6c2bfd9c70562021b4b1c8 (diff) |
Replace some usages of Common::printDebug w/ use of logger (#13968)
* Start refactoring Common::printDebug().
* Make tracker debug statement error log.
* Remove logger removal for tracker.
* Fix test failure.
* Add two more parent constructor calls.
* Fix failing test
Diffstat (limited to 'core/Common.php')
-rw-r--r-- | core/Common.php | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/core/Common.php b/core/Common.php index 6a6fad5df4..15f709ce7a 100644 --- a/core/Common.php +++ b/core/Common.php @@ -1259,34 +1259,20 @@ class Common } /** - * @todo This method is weird, it's debugging statements but seem to only work for the tracker, maybe it - * should be moved elsewhere + * @deprecated Use the logger directly instead. */ public static function printDebug($info = '') { - if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) { - if (!headers_sent()) { - // prevent XSS in tracker debug output - Common::sendHeader('Content-type: text/plain'); - } - - if (is_object($info)) { - $info = var_export($info, true); - } - - $logger = StaticContainer::get('Psr\Log\LoggerInterface'); + if (is_object($info)) { + $info = var_export($info, true); + } - if (is_array($info) || is_object($info)) { - $info = Common::sanitizeInputValues($info); - $out = var_export($info, true); - foreach (explode("\n", $out) as $line) { - $logger->debug($line); - } - } else { - foreach (explode("\n", $info) as $line) { - $logger->debug($line); - } - } + $logger = StaticContainer::get('Psr\Log\LoggerInterface'); + if (is_array($info) || is_object($info)) { + $out = var_export($info, true); + $logger->debug($out); + } else { + $logger->debug($info); } } |