public static function log_error($errno, $errstr, $errfile, $errline){
    if ( \defined('BBN_DATA_PATH') ){
      if ( is_dir(BBN_DATA_PATH.'logs') ){
        $file = BBN_DATA_PATH.'logs/_php_error.json';
        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20);
        $r = false;
        if ( is_file($file) ){
          $r = json_decode(file_get_contents($file), 1);
        }
        if ( !$r ){
          $r = [];
        }
        $t = date('Y-m-d H:i:s');
        if ( class_exists('\\bbn\\mvc') ){
          $mvc = mvc::get_instance();
        }
        $idx = self::find($r, [
          'type' => $errno,
          'error' => $errstr,
          'file' => $errfile,
          'line' => $errline,
          'request' => ''
        ]);
        if ( $idx !== false ){
          $r[$idx]['count']++;
          $r[$idx]['last_date'] = $t;
          $r[$idx]['backtrace'] = $backtrace;
        }
        else{
          $r[] = [
            'first_date' => $t,
            'last_date' => $t,
            'count' => 1,
            'type' => $errno,
            'error' => $errstr,
            'file' => $errfile,
            'line' => $errline,
            'backtrace' => $backtrace,
            'request' => ''
            //'context' => $context
          ];
        }
        self::sort_by($r, 'last_date', 'DESC');
        file_put_contents($file, json_encode($r, JSON_PRETTY_PRINT));
      }
      if ( $errno > 8 ){
        die($errstr);
      }
    }
    return false;
  }