Пример #1
0
 public function log($level, $msg, array $args = array(), \Exception $exception = null)
 {
     if ($this->isEnabledFor($level)) {
         $caller = \Plop\Plop::findCaller();
         $record = $this->recordFactory->createRecord($this->ns, $this->cls, $this->method, $caller['ns'], $caller['cls'], $caller['func'], $level, $caller['file'] ? $caller['file'] : '???', $caller['line'], $msg, $args, $exception);
         $this->handle($record);
     }
     return $this;
 }
Пример #2
0
 /**
  * @covers \Plop\Plop::findCaller
  */
 public function testFindCallerMethod()
 {
     $line = __LINE__ + 1;
     $caller = \Plop\Plop::findCaller();
     // Strip the namespace from the class name.
     $cls = substr('\\' . __CLASS__, strrpos('\\' . __CLASS__, '\\') + 1);
     $this->assertSame(__NAMESPACE__, $caller['ns']);
     $this->assertSame(__FILE__, $caller['file']);
     $this->assertSame($line, $caller['line']);
     $this->assertSame(__FUNCTION__, $caller['func']);
     $this->assertSame($cls, $caller['cls']);
 }