/**
  * Adds various system, Agavi and application specific debugging
  * information to the given logger message as a json string.
  *
  * @param AgaviLoggerMessage $message
  *
  * @return void
  */
 public function write(AgaviLoggerMessage $message)
 {
     $message_text = $message->getMessage();
     $extra = LoggerManager::getExtraInformation();
     $message->setMessage($message_text . ' extra=' . json_encode($extra));
     parent::write($message);
 }
 /**
  * Replace placeholders (keys) with values in the given message.
  *
  * @param string $message log message with placeholders
  * @param array $context associative array of key => value pairs to use for replacement
  *
  * @return string message with replaced values from context
  */
 public static function replacePlaceholders($message, array $context = [])
 {
     if (is_array($message) || is_string($message) && false === strpos($message, '{')) {
         return $message;
     }
     $replacements = [];
     // build the replacement array with braces around the context keys
     foreach ($context as $key => $value) {
         $replacements['{' . $key . '}'] = LoggerManager::getAsString($value);
     }
     // replace placeholders and return the message
     return strtr($message, $replacements);
 }
 /**
  * @param array $record Monolog log record with message, context, extra
  *
  * @return array with additional extra information
  */
 public function __invoke(array $record)
 {
     $record['extra'] = array_merge($record['extra'], LoggerManager::getExtraInformation());
     return $record;
 }