4 * This file is part of the Monolog package.
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Monolog\Formatter;
17 class FluentdFormatterTest extends TestCase
20 * @covers Monolog\Formatter\FluentdFormatter::__construct
21 * @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag
23 public function testConstruct()
25 $formatter = new FluentdFormatter();
26 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
27 $formatter = new FluentdFormatter(false);
28 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
29 $formatter = new FluentdFormatter(true);
30 $this->assertEquals(true, $formatter->isUsingLevelsInTag());
34 * @covers Monolog\Formatter\FluentdFormatter::format
36 public function testFormat()
38 $record = $this->getRecord(Logger::WARNING);
39 $record['datetime'] = new \DateTime("@0");
41 $formatter = new FluentdFormatter();
43 '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
44 $formatter->format($record)
49 * @covers Monolog\Formatter\FluentdFormatter::format
51 public function testFormatWithTag()
53 $record = $this->getRecord(Logger::ERROR);
54 $record['datetime'] = new \DateTime("@0");
56 $formatter = new FluentdFormatter(true);
58 '["test.error",0,{"message":"test","extra":[]}]',
59 $formatter->format($record)