Пример #1
0
 public function get($itemsToGet = 100, $offset = 0)
 {
     $r = parent::get($itemsToGet, intval($offset));
     $entries = array();
     foreach ($r as $row) {
         $e = LogEntry::getByID($row['logID']);
         if (is_object($e)) {
             $entries[] = $e;
         }
     }
     return $entries;
 }
Пример #2
0
 public function testLegacyLogSupport()
 {
     Log::addEntry("this is my log entry.");
     $le = LogEntry::getByID(1);
     $this->assertEquals($le->getLevel(), Logger::DEBUG);
     $this->assertEquals($le->getLevelName(), 'DEBUG');
     $this->assertEquals($le->getMessage(), 'this is my log entry.');
     /*
      * old format here:
     $l = new Log(LOG_TYPE_EMAILS, true, true);
     $l->write('This is line one.');
     $l->write('This is line two');
     $l->close();
     */
     $l = new GroupLogger(LOG_TYPE_EMAILS, Logger::DEBUG);
     $l->write('This is line one.');
     $l->write('This is line two.');
     $l2 = new GroupLogger('test', Logger::CRITICAL);
     $l2->write('OMG!');
     $l2->close();
     $l->close();
     $le2 = LogEntry::getByID(2);
     $le3 = LogEntry::getByID(3);
     $this->assertEquals($le2->getLevel(), Logger::CRITICAL);
     $this->assertEquals($le3->getLevel(), Logger::DEBUG);
     $this->assertEquals($le3->getMessage(), "This is line one.\nThis is line two.");
     $this->assertEquals($le2->getMessage(), "OMG!");
 }