Monolog
More...
Monolog
Definition at line 17 of file LineFormatterTest.php.
◆ testBatchFormat()
Monolog\Formatter\LineFormatterTest::testBatchFormat |
( |
| ) |
|
Definition at line 158 of file LineFormatterTest.php.
References $message.
160 $formatter =
new LineFormatter(null,
'Y-m-d');
161 $message = $formatter->formatBatch(array(
163 'level_name' =>
'CRITICAL',
166 'context' => array(),
171 'level_name' =>
'WARNING',
174 'context' => array(),
179 $this->assertEquals(
'['.date(
'Y-m-d').
'] test.CRITICAL: bar [] []'.
"\n".
'['.date(
'Y-m-d').
'] log.WARNING: foo [] []'.
"\n",
$message);
catch(Exception $e) $message
◆ testContextAndExtraOptionallyNotShownIfEmpty()
Monolog\Formatter\LineFormatterTest::testContextAndExtraOptionallyNotShownIfEmpty |
( |
| ) |
|
Definition at line 80 of file LineFormatterTest.php.
References $message.
82 $formatter =
new LineFormatter(null,
'Y-m-d',
false,
true);
84 'level_name' =>
'ERROR',
91 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: log '.
"\n",
$message);
catch(Exception $e) $message
◆ testContextAndExtraReplacement()
Monolog\Formatter\LineFormatterTest::testContextAndExtraReplacement |
( |
| ) |
|
Definition at line 94 of file LineFormatterTest.php.
References $message.
96 $formatter =
new LineFormatter(
'%context.foo% => %extra.foo%');
98 'level_name' =>
'ERROR',
100 'context' => array(
'foo' =>
'bar'),
102 'extra' => array(
'foo' =>
'xbar'),
105 $this->assertEquals(
'bar => xbar',
$message);
catch(Exception $e) $message
◆ testDefFormatExtras()
Monolog\Formatter\LineFormatterTest::testDefFormatExtras |
( |
| ) |
|
Definition at line 52 of file LineFormatterTest.php.
References $message.
54 $formatter =
new LineFormatter(null,
'Y-m-d');
56 'level_name' =>
'ERROR',
60 'extra' => array(
'ip' =>
'127.0.0.1'),
63 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: log [] {"ip":"127.0.0.1"}'.
"\n",
$message);
catch(Exception $e) $message
◆ testDefFormatWithArrayContext()
Monolog\Formatter\LineFormatterTest::testDefFormatWithArrayContext |
( |
| ) |
|
Definition at line 33 of file LineFormatterTest.php.
References $message.
35 $formatter =
new LineFormatter(null,
'Y-m-d');
37 'level_name' =>
'ERROR',
49 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'.
"\n",
$message);
catch(Exception $e) $message
◆ testDefFormatWithException()
Monolog\Formatter\LineFormatterTest::testDefFormatWithException |
( |
| ) |
|
Definition at line 123 of file LineFormatterTest.php.
References $message, and $path.
125 $formatter =
new LineFormatter(null,
'Y-m-d');
126 $message = $formatter->format(array(
127 'level_name' =>
'CRITICAL',
132 'message' =>
'foobar',
135 $path = str_replace(
'\\/',
'/', json_encode(__FILE__));
137 $this->assertEquals(
'['.date(
'Y-m-d').
'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr(
$path, 1, -1).
':'.(__LINE__ - 8).
')"} []'.
"\n",
$message);
catch(Exception $e) $message
◆ testDefFormatWithObject()
Monolog\Formatter\LineFormatterTest::testDefFormatWithObject |
( |
| ) |
|
Definition at line 108 of file LineFormatterTest.php.
References $message.
110 $formatter =
new LineFormatter(null,
'Y-m-d');
111 $message = $formatter->format(array(
112 'level_name' =>
'ERROR',
114 'context' => array(),
116 'extra' => array(
'foo' =>
new TestFoo,
'bar' =>
new TestBar,
'baz' => array(),
'res' =>
fopen(
'php://memory',
'rb')),
117 'message' =>
'foobar',
120 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'.
"\n",
$message);
catch(Exception $e) $message
◆ testDefFormatWithPreviousException()
Monolog\Formatter\LineFormatterTest::testDefFormatWithPreviousException |
( |
| ) |
|
Definition at line 140 of file LineFormatterTest.php.
References $message, and $path.
142 $formatter =
new LineFormatter(null,
'Y-m-d');
143 $previous = new \LogicException(
'Wut?');
144 $message = $formatter->format(array(
145 'level_name' =>
'CRITICAL',
147 'context' => array(
'exception' =>
new \
RuntimeException(
'Foo', 0, $previous)),
150 'message' =>
'foobar',
153 $path = str_replace(
'\\/',
'/', json_encode(__FILE__));
155 $this->assertEquals(
'['.date(
'Y-m-d').
'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr(
$path, 1, -1).
':'.(__LINE__ - 8).
', LogicException(code: 0): Wut? at '.substr(
$path, 1, -1).
':'.(__LINE__ - 12).
')"} []'.
"\n",
$message);
catch(Exception $e) $message
◆ testDefFormatWithString()
Monolog\Formatter\LineFormatterTest::testDefFormatWithString |
( |
| ) |
|
Definition at line 19 of file LineFormatterTest.php.
References $message.
21 $formatter =
new LineFormatter(null,
'Y-m-d');
23 'level_name' =>
'WARNING',
30 $this->assertEquals(
'['.date(
'Y-m-d').
'] log.WARNING: foo [] []'.
"\n",
$message);
catch(Exception $e) $message
◆ testFormatExtras()
Monolog\Formatter\LineFormatterTest::testFormatExtras |
( |
| ) |
|
Definition at line 66 of file LineFormatterTest.php.
References $message.
68 $formatter =
new LineFormatter(
"[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n",
'Y-m-d');
70 'level_name' =>
'ERROR',
74 'extra' => array(
'ip' =>
'127.0.0.1',
'file' =>
'test'),
77 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'.
"\n",
$message);
catch(Exception $e) $message
◆ testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet()
Monolog\Formatter\LineFormatterTest::testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet |
( |
| ) |
|
Definition at line 196 of file LineFormatterTest.php.
References $message.
198 $formatter =
new LineFormatter(null,
'Y-m-d',
true);
201 'message' =>
"foo\nbar",
202 'context' => array(),
207 $this->assertRegExp(
'/foo\nbar/',
$message);
catch(Exception $e) $message
◆ testFormatShouldStripInlineLineBreaks()
Monolog\Formatter\LineFormatterTest::testFormatShouldStripInlineLineBreaks |
( |
| ) |
|
Definition at line 182 of file LineFormatterTest.php.
References $message.
184 $formatter =
new LineFormatter(null,
'Y-m-d');
187 'message' =>
"foo\nbar",
188 'context' => array(),
193 $this->assertRegExp(
'/foo bar/',
$message);
catch(Exception $e) $message
The documentation for this class was generated from the following file: