Monolog
More...
Monolog
Definition at line 17 of file LineFormatterTest.php.
◆ testBatchFormat()
Monolog\Formatter\LineFormatterTest::testBatchFormat |
( |
| ) |
|
Definition at line 144 of file LineFormatterTest.php.
146 $formatter =
new LineFormatter(null,
'Y-m-d');
147 $message = $formatter->formatBatch(array(
149 'level_name' =>
'CRITICAL',
152 'context' => array(),
153 'datetime' =>
new \DateTime,
157 'level_name' =>
'WARNING',
160 'context' => array(),
161 'datetime' =>
new \DateTime,
165 $this->assertEquals(
'['.date(
'Y-m-d').
'] test.CRITICAL: bar [] []'.
"\n".
'['.date(
'Y-m-d').
'] log.WARNING: foo [] []'.
"\n", $message);
◆ testContextAndExtraOptionallyNotShownIfEmpty()
Monolog\Formatter\LineFormatterTest::testContextAndExtraOptionallyNotShownIfEmpty |
( |
| ) |
|
Definition at line 80 of file LineFormatterTest.php.
82 $formatter =
new LineFormatter(null,
'Y-m-d',
false,
true);
83 $message = $formatter->format(array(
84 'level_name' =>
'ERROR',
87 'datetime' =>
new \DateTime,
91 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: log '.
"\n", $message);
◆ testDefFormatExtras()
Monolog\Formatter\LineFormatterTest::testDefFormatExtras |
( |
| ) |
|
Definition at line 52 of file LineFormatterTest.php.
54 $formatter =
new LineFormatter(null,
'Y-m-d');
55 $message = $formatter->format(array(
56 'level_name' =>
'ERROR',
59 'datetime' =>
new \DateTime,
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);
◆ testDefFormatWithArrayContext()
Monolog\Formatter\LineFormatterTest::testDefFormatWithArrayContext |
( |
| ) |
|
Definition at line 33 of file LineFormatterTest.php.
35 $formatter =
new LineFormatter(null,
'Y-m-d');
36 $message = $formatter->format(array(
37 'level_name' =>
'ERROR',
40 'datetime' =>
new \DateTime,
49 $this->assertEquals(
'['.date(
'Y-m-d').
'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'.
"\n", $message);
◆ testDefFormatWithException()
Monolog\Formatter\LineFormatterTest::testDefFormatWithException |
( |
| ) |
|
Definition at line 109 of file LineFormatterTest.php.
References $path.
111 $formatter =
new LineFormatter(null,
'Y-m-d');
112 $message = $formatter->format(array(
113 'level_name' =>
'CRITICAL',
116 'datetime' =>
new \DateTime,
118 'message' =>
'foobar',
121 $path = str_replace(
'\\/',
'/', json_encode(__FILE__));
123 $this->assertEquals(
'['.date(
'Y-m-d').
'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr(
$path, 1, -1).
':'.(__LINE__-8).
')"} []'.
"\n", $message);
◆ testDefFormatWithObject()
Monolog\Formatter\LineFormatterTest::testDefFormatWithObject |
( |
| ) |
|
Definition at line 94 of file LineFormatterTest.php.
96 $formatter =
new LineFormatter(null,
'Y-m-d');
97 $message = $formatter->format(array(
98 'level_name' =>
'ERROR',
100 'context' => array(),
101 'datetime' =>
new \DateTime,
102 'extra' => array(
'foo' =>
new TestFoo,
'bar' =>
new TestBar,
'baz' => array(),
'res' => fopen(
'php://memory',
'rb')),
103 'message' =>
'foobar',
106 $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]"}'.
"\n", $message);
◆ testDefFormatWithPreviousException()
Monolog\Formatter\LineFormatterTest::testDefFormatWithPreviousException |
( |
| ) |
|
Definition at line 126 of file LineFormatterTest.php.
References $path.
128 $formatter =
new LineFormatter(null,
'Y-m-d');
129 $previous = new \LogicException(
'Wut?');
130 $message = $formatter->format(array(
131 'level_name' =>
'CRITICAL',
133 'context' => array(
'exception' =>
new \
RuntimeException(
'Foo', 0, $previous)),
134 'datetime' =>
new \DateTime,
136 'message' =>
'foobar',
139 $path = str_replace(
'\\/',
'/', json_encode(__FILE__));
141 $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);
◆ testDefFormatWithString()
Monolog\Formatter\LineFormatterTest::testDefFormatWithString |
( |
| ) |
|
Definition at line 19 of file LineFormatterTest.php.
21 $formatter =
new LineFormatter(null,
'Y-m-d');
22 $message = $formatter->format(array(
23 'level_name' =>
'WARNING',
27 'datetime' =>
new \DateTime,
30 $this->assertEquals(
'['.date(
'Y-m-d').
'] log.WARNING: foo [] []'.
"\n", $message);
◆ testFormatExtras()
Monolog\Formatter\LineFormatterTest::testFormatExtras |
( |
| ) |
|
Definition at line 66 of file LineFormatterTest.php.
68 $formatter =
new LineFormatter(
"[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n",
'Y-m-d');
69 $message = $formatter->format(array(
70 'level_name' =>
'ERROR',
73 'datetime' =>
new \DateTime,
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);
◆ testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet()
Monolog\Formatter\LineFormatterTest::testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet |
( |
| ) |
|
Definition at line 182 of file LineFormatterTest.php.
184 $formatter =
new LineFormatter(null,
'Y-m-d',
true);
185 $message = $formatter->format(
187 'message' =>
"foo\nbar",
188 'context' => array(),
193 $this->assertRegExp(
'/foo\nbar/', $message);
◆ testFormatShouldStripInlineLineBreaks()
Monolog\Formatter\LineFormatterTest::testFormatShouldStripInlineLineBreaks |
( |
| ) |
|
Definition at line 168 of file LineFormatterTest.php.
170 $formatter =
new LineFormatter(null,
'Y-m-d');
171 $message = $formatter->format(
173 'message' =>
"foo\nbar",
174 'context' => array(),
179 $this->assertRegExp(
'/foo bar/', $message);
The documentation for this class was generated from the following file: