diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-04-12 07:27:47 +0300 |
---|---|---|
committer | Benaka <diosmosis@users.noreply.github.com> | 2018-04-12 07:27:47 +0300 |
commit | 6b42db96c01c5b1357c42c1de1655ba4114a9d3e (patch) | |
tree | d63ddccdfff327bfcb2967f0de22ee0754cf50ef /plugins/Monolog/tests | |
parent | c5fc11d125cf1c8495f043e6b429d9ff0e34967a (diff) |
Log a job ID for cli commands (#12717)
* log requestId for cli commands
* format console log
* log pid for cli commands
* fix test
Diffstat (limited to 'plugins/Monolog/tests')
-rw-r--r-- | plugins/Monolog/tests/Integration/LogTest.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/Monolog/tests/Integration/LogTest.php b/plugins/Monolog/tests/Integration/LogTest.php index 75a8166d4f..0389b504f0 100644 --- a/plugins/Monolog/tests/Integration/LogTest.php +++ b/plugins/Monolog/tests/Integration/LogTest.php @@ -26,12 +26,12 @@ class LogTest extends IntegrationTestCase { const TESTMESSAGE = 'test%smessage'; const STRING_MESSAGE_FORMAT = '[%tag%] %message%'; - const STRING_MESSAGE_FORMAT_SPRINTF = "[%s] %s"; + const STRING_MESSAGE_FORMAT_SPRINTF = "[%s] [%s] %s"; - public static $expectedExceptionOutput = '[Monolog] LogTest.php(112): dummy error message + public static $expectedExceptionOutput = '[Monolog] [%s] LogTest.php(112): dummy error message dummy backtrace'; - public static $expectedErrorOutput = '[Monolog] dummyerrorfile.php(145): Unknown error (102) - dummy error string + public static $expectedErrorOutput = '[Monolog] [%s] dummyerrorfile.php(145): Unknown error (102) - dummy error string dummy backtrace'; public function setUp() @@ -99,7 +99,7 @@ class LogTest extends IntegrationTestCase $error = new \ErrorException("dummy error string", 0, 102, "dummyerrorfile.php", 145); Log::error($error); - $this->checkBackend($backend, self::$expectedErrorOutput, $formatMessage = false, $tag = 'Monolog'); + $this->checkBackend($backend, sprintf(self::$expectedErrorOutput, getmypid()), $formatMessage = false, $tag = 'Monolog'); } /** @@ -112,7 +112,7 @@ class LogTest extends IntegrationTestCase $exception = new Exception("dummy error message"); Log::error($exception); - $this->checkBackend($backend, self::$expectedExceptionOutput, $formatMessage = false, $tag = 'Monolog'); + $this->checkBackend($backend, sprintf(self::$expectedExceptionOutput, getmypid()), $formatMessage = false, $tag = 'Monolog'); } /** @@ -192,7 +192,7 @@ class LogTest extends IntegrationTestCase private function checkBackend($backend, $expectedMessage, $formatMessage = false, $tag = false) { if ($formatMessage) { - $expectedMessage = sprintf(self::STRING_MESSAGE_FORMAT_SPRINTF, $tag, $expectedMessage); + $expectedMessage = sprintf(self::STRING_MESSAGE_FORMAT_SPRINTF, $tag, getmypid(), $expectedMessage); } if ($backend == 'file') { @@ -201,7 +201,7 @@ class LogTest extends IntegrationTestCase $fileContents = file_get_contents(self::getLogFileLocation()); $fileContents = $this->removePathsFromBacktrace($fileContents); - $expectedMessage = str_replace("\n ", "\n[Monolog]", $expectedMessage); + $expectedMessage = str_replace("\n ", "\n[Monolog] [" . getmypid() . "]", $expectedMessage); $this->assertEquals($expectedMessage . "\n", $fileContents); } else if ($backend == 'database') { |