protected function isTriggered(Entry $entry) { $emailLevel = env('LOGGER_EMAIL_LEVEL', false); if (!$emailLevel || $this->config->get('app.debug')) { return false; } $emailLevelCode = MonologLogger::getLevels()[$emailLevel]; return $entry->getCode() >= $emailLevelCode; }
/** * @test */ public function normalConstructionAndAccessors() { $entry = new Entry('test', 'INFO', 'Test message', ['abc' => 123]); $this->assertTrue($entry instanceof Entry); $this->assertEquals('test', $entry->getChannel()); $this->assertEquals('INFO', $entry->getLevel()); $this->assertEquals(200, $entry->getCode()); $this->assertEquals('Test message', $entry->getMessage()); $this->assertEquals(['abc' => 123], $entry->getContext()); }
/** * @param Entry $entry * @return null */ public function write(Entry $entry) { $log = new MonologLogger($entry->getChannel()); $log->pushHandler(new StreamHandler($this->getPath($entry->getChannel()), $entry->getCode())); $log->addRecord($entry->getCode(), $entry->getMessage(), $entry->getContext()); }