Exemplo n.º 1
0
 public function testGetsetappendMessage()
 {
     $message = new AgaviLoggerMessage();
     $message->setMessage('my message');
     $this->assertEquals('my message', $message->getMessage());
     $message->setMessage('my message 2');
     $this->assertEquals('my message 2', $message->getMessage());
     $message->appendMessage('my message 3');
     $this->assertEquals(array('my message 2', 'my message 3'), $message->getMessage());
 }
 /**
  * Format a message.
  *
  * @param      AgaviLoggerMessage An AgaviLoggerMessage instance.
  *
  * @return     string A formatted message.
  *
  * @author     Bob Zoller <*****@*****.**>
  * @since      0.10.0
  */
 public function format(AgaviLoggerMessage $message)
 {
     switch ($this->getParameter('mode', 'to_string')) {
         case 'full':
             return $message;
         case 'message':
             return $message->getMessage();
         case 'parameter':
             return $message->getParameter($this->getParameter('parameter', 'message'));
         default:
             return $message->__toString();
     }
 }
Exemplo n.º 3
0
 /**
  * Format a message.
  *
  * @param      AgaviLoggerMessage An AgaviLoggerMessage instance.
  *
  * @return     string The AgaviLoggerMessage object as a JSON-encoded string.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      1.0.4
  */
 public function format(AgaviLoggerMessage $message)
 {
     switch ($this->getParameter('mode', 'parameters')) {
         case 'full':
             $value = $message;
             break;
         case 'message':
             $value = $message->getMessage();
             break;
         case 'parameter':
             $value = $message->getParameter($this->getParameter('parameter', 'message'));
             break;
         default:
             $value = $message->getParameters();
     }
     return json_encode($value);
 }