/** * (non-PHPdoc) * @see AgaviLoggerAppender::write() */ public function write(AgaviLoggerMessage $message) { if (($layout = $this->getLayout()) === null) { throw new AgaviLoggingException('No Layout set'); } $NsmLog = new NsmLog(); $NsmLog->log_level = $message->getParameter('level'); $NsmLog->log_message = $this->getLayout()->format($message); $NsmLog->save(); }
/** * 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(); } }
/** * 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); }
/** * Write log data to this appender. * * @param AgaviLoggerMessage Log data to be written. * * @throws <b>AgaviLoggingException</b> if no Layout is set or the stream * cannot be written. * * * @author David Zülke <*****@*****.**> * @since 1.0.4 */ public function write(AgaviLoggerMessage $message) { if (($layout = $this->getLayout()) === null) { throw new AgaviLoggingException('No Layout set'); } $this->buffer[] = new LogEntry(array('category' => $message->getParameter('scribe.category', $this->getParameter('default_category', 'default')), 'message' => (string) $this->getLayout()->format($message))); if (!$this->getParameter('buffer', false)) { $this->flush(); } }