Exemple #1
0
    private static void CaptureLog(string condition, string stacktrace, LogType type)
    {
        if (type == LogType.Error)
        {
            errorDict.Clear();

            string url = ServerInfoConfig.GetErrorURL();
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            errorDict.Add("msg", condition + "\n" + stacktrace);
            errorDict.Add("game", ServerInfoConfig.GetGame());
            errorDict.Add("environment", "android");
            string deviceID = "";
            //string deviceID = SystemInfo.deviceUniqueIdentifier;
            if (!string.IsNullOrEmpty(deviceID))
            {
                errorDict.Add("deviceId", deviceID);
            }
            string deviceName = "";
            if (!string.IsNullOrEmpty(deviceName))
            {
                errorDict.Add("deviceName", deviceName);
            }
            string platform = "jzwl";
            if (!string.IsNullOrEmpty(platform))
            {
                errorDict.Add("platform", platform);
            }
            string accountName = "";
            if (!string.IsNullOrEmpty(accountName))
            {
                errorDict.Add("account", accountName);
            }
            string accountTicket = "";
            if (!string.IsNullOrEmpty(accountName))
            {
                errorDict.Add("ticket", accountTicket);
            }
            long playerId = 0;
            if (playerId != 0)
            {
                errorDict.Add("playerId", playerId.ToString());
            }

            if (errorDict != null && errorDict.Count > 0)
            {
                string reqUrl = url + "?";
                foreach (KeyValuePair <string, string> post_arg in errorDict)
                {
                    reqUrl += post_arg.Key + "=" + WWW.EscapeURL(post_arg.Value, System.Text.Encoding.UTF8) + "&";
                }
                reqUrl = reqUrl.Remove(reqUrl.Length - 1);

                try
                {
                    System.Net.WebRequest  wReq  = System.Net.WebRequest.Create(reqUrl);
                    System.Net.WebResponse wResp = wReq.GetResponse();
                    wResp.GetResponseStream();
                }
                catch (System.Exception)
                {
                    //errorMsg = ex.Message;
                }
            }
        }
    }