コード例 #1
0
  public static void e(int errorcode, String msg, Throwable e, CommonAdVO vo) {
    if (msg != null) {
      if (SwitchConfig.LOG) {
        if (e != null) {
          msg += e.getMessage();
        }
        Log.e(TAG, msg);
      }

      if (SwitchConfig.ERROR && context != null) {
        HashMap<String, String> data = new HashMap<String, String>();
        int etype = errorcode / 100;
        data.put("etype", etype + "");
        data.put("ecode", errorcode + "");
        data.put("emsg", Utils.base64Encode(msg));
        data.put("etime", System.currentTimeMillis() + "");

        if (e != null) {
          data.put("exception", Utils.base64Encode(e.getMessage()));
          String trace = Utils.stackTraceToString(e);
          data.put("trace", Utils.base64Encode(trace));
        }

        data.putAll(getBasicParameters());

        if (vo != null) {
          data.putAll(getAdParameters(vo));
        }

        final HashMap<String, String> logdata = data;

        new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    LogUploader.postLog(logdata, context, true);
                  }
                })
            .start();
      }
    }
  }