Example #1
0
 /**
  * @param mixed $entity
  * @param string $message
  * @param null $begin
  * @param null $var
  */
 public static function log($entity = null, $message = null, $begin = null, $var = null)
 {
     $conf = Conf::get('logger_helper');
     self::add($message);
     $message = self::createErrorMessage($entity, $conf['level'], $message, $begin, $var);
     Logger::log($message, $conf['level'], $conf['file'], false);
 }
Example #2
0
 /**
  * @param $msg
  * @param string $type
  */
 public static function save($msg, $type = self::LOG)
 {
     $confErrors = Conf::get('errors');
     $confApp = Conf::get('app');
     $file = $confApp['root'] . $confApp['path'] . '/' . $confErrors['path'] . '/' . $confErrors['filename'] . '.' . $type;
     Logger::log($msg, Logger::CRITICAL, $file, false);
 }
Example #3
0
 /**
  * @param $query
  * @param string $type
  * @param array|null $rows
  * @param bool|false $isPreparedQuery
  * @throws \Exception
  */
 public function prepare($query, $type = QueryBuilder::SELECT, array $rows = array(), $isPreparedQuery = false)
 {
     if ($query instanceof QueryBuilder) {
         $this->query = $query->build($type, $rows);
     } else {
         $this->query = $query;
     }
     Logger::log($this->query, Logger::DEBUG);
     $this->type = $type;
     $this->isPreparedQuery = $isPreparedQuery;
     if ($this->isPreparedQuery) {
         $this->pdoStmt = $this->pdo->prepare($this->query);
     }
 }
Example #4
0
 /**
  * Create route informations
  *
  * @param $routeParameters
  * @throws \Exception
  */
 private static function createRouteInfos($routeParameters)
 {
     $setName = true;
     $pattern = '';
     foreach ($routeParameters as $routeNameFormatted => $result) {
         if ($setName === true) {
             $pattern = $result;
             if (!empty(self::$allRoutes[$routeNameFormatted])) {
                 self::$routeInfos = self::$allRoutes[$routeNameFormatted];
                 Logger::log('[' . __CLASS__ . '] route matches -> ' . $routeNameFormatted, Logger::DEBUG);
             }
             $setName = false;
         } elseif ($result !== $pattern) {
             self::$routeInfos['argv'][] = $result;
         }
     }
     if (empty(self::$routeInfos)) {
         throw new \Exception('route no match !');
     }
 }
Example #5
0
 /**
  * @param string $method
  * @param array $arguments
  */
 public function __call($method, array $arguments)
 {
     Logger::log('Undefined method : ' . $method . 'called with : ' . var_export($arguments, true), Logger::INFO);
 }