Пример #1
0
 /**
  * @param string     $message
  * @param null|array $args
  * @param bool       $end_line
  * @param bool       $output
  */
 static function writeReplace($message, $args = NULL, $end_line = FALSE, $output = TRUE)
 {
     if (Kohana_Helpers_Core::isCLI() && self::classExists()) {
         $args = Kohana_Helpers_Arr::asArray($args);
         if ($output) {
             Kohana_Minion_CLI::write_replace(self::date() . strtr($message, $args), $end_line);
         } elseif (FALSE !== ($logLevel = self::config('cli.log.replace', static::$logReplace))) {
             Kohana::$log->add($logLevel, $message, $args);
         }
     }
 }
Пример #2
0
 /**
  * @param Exception $e
  *
  * @return array|null
  */
 public static function exception(Exception $e = NULL)
 {
     if ($e instanceof Exception) {
         $data = ['message' => Helpers_Text::trimAsNULL($e->getMessage()), 'code' => $e->getCode()];
         if (!Kohana_Helpers_Core::isProduction()) {
             $data = Kohana_Helpers_Arr::merge($data, ['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace(), 'previous' => Helpers_Arr::exception($e->getPrevious())]);
         }
     } else {
         $data = NULL;
     }
     return $data;
 }