예제 #1
0
 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;
 }
예제 #2
0
파일: EntryTest.php 프로젝트: nztim/logger
 /**
  * @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());
 }
예제 #3
0
 /**
  * @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());
 }