From 6acb3a922b48368710f32eefaa8f2bd6f7d7a735 Mon Sep 17 00:00:00 2001 From: Alex Brausewetter Date: Tue, 12 Mar 2013 18:04:55 +0100 Subject: [PATCH 1/2] Revert "Fix ChromePhp logger interface and debug level" This reverts commit e701e7b3a7535aa44dd29b570cee0cf81bb34bd5. --- src/Writer/ChromePhp.php | 3 ++ src/Writer/ChromePhp/ChromePhpBridge.php | 42 ++++++--------------- src/Writer/ChromePhp/ChromePhpInterface.php | 30 ++++----------- test/TestAsset/MockChromePhp.php | 22 +++-------- test/Writer/ChromePhpTest.php | 4 +- 5 files changed, 30 insertions(+), 71 deletions(-) diff --git a/src/Writer/ChromePhp.php b/src/Writer/ChromePhp.php index d00ffe4b..97f8522b 100644 --- a/src/Writer/ChromePhp.php +++ b/src/Writer/ChromePhp.php @@ -74,6 +74,9 @@ protected function doWrite(array $event) case Logger::INFO: $this->chromephp->info($line); break; + case Logger::DEBUG: + $this->chromephp->trace($line); + break; default: $this->chromephp->log($line); break; diff --git a/src/Writer/ChromePhp/ChromePhpBridge.php b/src/Writer/ChromePhp/ChromePhpBridge.php index 446535ca..758690bd 100644 --- a/src/Writer/ChromePhp/ChromePhpBridge.php +++ b/src/Writer/ChromePhp/ChromePhpBridge.php @@ -14,17 +14,17 @@ class ChromePhpBridge implements ChromePhpInterface { /** - * Log a message + * Log an error message * * @param string $line */ - public function log($line) + public function error($line) { - ChromePhp::log($line); + ChromePhp::error($line); } /** - * Log a warning message + * Log a warning * * @param string $line */ @@ -34,17 +34,7 @@ public function warn($line) } /** - * Log an error message - * - * @param string $line - */ - public function error($line) - { - ChromePhp::error($line); - } - - /** - * Log an info message + * Log informational message * * @param string $line */ @@ -54,32 +44,22 @@ public function info($line) } /** - * Sends a group log + * Log a trace * * @param string $line */ - public function group($line) + public function trace($line) { - ChromePhp::group($line); - } - - /** - * Sends a collapsed group log - * - * @param string $line - */ - public function groupCollapsed($line) - { - ChromePhp::groupCollapsed($line); + ChromePhp::error($line); } /** - * Ends a group log + * Log a message * * @param string $line */ - public function groupEnd($line) + public function log($line) { - ChromePhp::groupEnd($line); + ChromePhp::log($line); } } diff --git a/src/Writer/ChromePhp/ChromePhpInterface.php b/src/Writer/ChromePhp/ChromePhpInterface.php index 66cd0d08..184a48fc 100644 --- a/src/Writer/ChromePhp/ChromePhpInterface.php +++ b/src/Writer/ChromePhp/ChromePhpInterface.php @@ -11,20 +11,6 @@ interface ChromePhpInterface { - /** - * Log a message - * - * @param string $line - */ - public function log($line); - - /** - * Log a warning message - * - * @param string $line - */ - public function warn($line); - /** * Log an error message * @@ -33,30 +19,30 @@ public function warn($line); public function error($line); /** - * Log an info message + * Log a warning * * @param string $line */ - public function info($line); + public function warn($line); /** - * Sends a group log + * Log informational message * * @param string $line */ - public function group($line); + public function info($line); /** - * Sends a collapsed group log + * Log a trace * * @param string $line */ - public function groupCollapsed($line); + public function trace($line); /** - * Ends a group log + * Log a message * * @param string $line */ - public function groupEnd($line); + public function log($line); } diff --git a/test/TestAsset/MockChromePhp.php b/test/TestAsset/MockChromePhp.php index efa44f78..814bedfe 100644 --- a/test/TestAsset/MockChromePhp.php +++ b/test/TestAsset/MockChromePhp.php @@ -19,9 +19,9 @@ public function getEnabled() return $this->enabled; } - public function log($line) + public function error($line) { - $this->calls['log'][] = $line; + $this->calls['error'][] = $line; } public function warn($line) @@ -29,28 +29,18 @@ public function warn($line) $this->calls['warn'][] = $line; } - public function error($line) - { - $this->calls['error'][] = $line; - } - public function info($line) { $this->calls['info'][] = $line; } - public function group($line) + public function trace($line) { - $this->calls['group'][] = $line; + $this->calls['trace'][] = $line; } - public function groupCollapsed($line) - { - $this->calls['groupCollapsed'][] = $line; - } - - public function groupEnd($line) + public function log($line) { - $this->calls['groupEnd'][] = $line; + $this->calls['log'][] = $line; } } diff --git a/test/Writer/ChromePhpTest.php b/test/Writer/ChromePhpTest.php index 582710b4..05c021e8 100644 --- a/test/Writer/ChromePhpTest.php +++ b/test/Writer/ChromePhpTest.php @@ -67,7 +67,7 @@ public function testWrite() 'message' => 'my msg', 'priority' => Logger::DEBUG )); - $this->assertEquals('my msg', $this->chromephp->calls['log'][0]); + $this->assertEquals('my msg', $this->chromephp->calls['trace'][0]); } public function testWriteDisabled() @@ -78,7 +78,7 @@ public function testWriteDisabled() 'message' => 'my msg', 'priority' => Logger::DEBUG )); - $this->assertEmpty($this->chromephp->calls); + $this->assertTrue(empty($this->chromephp->calls)); } public function testConstructWithOptions() From e1bd4567309e09ed43cdbfc6c2229b34e0d921dd Mon Sep 17 00:00:00 2001 From: Alex Brausewetter Date: Tue, 12 Mar 2013 18:06:20 +0100 Subject: [PATCH 2/2] Prevent ChromePhp log from showing debug as error --- src/Writer/ChromePhp/ChromePhpBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Writer/ChromePhp/ChromePhpBridge.php b/src/Writer/ChromePhp/ChromePhpBridge.php index 758690bd..ae2e5fa2 100644 --- a/src/Writer/ChromePhp/ChromePhpBridge.php +++ b/src/Writer/ChromePhp/ChromePhpBridge.php @@ -50,7 +50,7 @@ public function info($line) */ public function trace($line) { - ChromePhp::error($line); + ChromePhp::log($line); } /**