Beispiel #1
0
    void Awake()
    {
        LuaSystem.Init();
        TimeSpan timeSpa1n = DateTime.Today.ToUniversalTime() - new DateTime(1970, 1, 1);

        Application.logMessageReceived += (string condition, string stackTrace, LogType type) =>
        {
            if (type.Equals(LogType.Exception) || type.Equals(LogType.Error))
            {
                TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0);

                string timeStamp = ((int)timeSpan.TotalSeconds).ToString();

                string hostName    = System.Net.Dns.GetHostName();
                string userName    = System.Environment.UserName;
                string machineName = System.Environment.MachineName;

                ToLuaUtility.HttpPostRequest("http://192.168.8.216/errlog.php",
                                             (UnityWebRequest req) => { Debug.Log(req.downloadHandler.text); }, "", "submit",
                                             "logType", type.ToString(),
                                             "condition", condition,
                                             "stackTrace", stackTrace,
                                             "timeStamp", timeStamp,
                                             "hostName", hostName,
                                             "userName", userName,
                                             "machineName", machineName
                                             );
            }
        };
    }
Beispiel #2
0
        static int _m_HttpPostRequest_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action <UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate <System.Action <UnityEngine.Networking.UnityWebRequest> >(L, 2);
                    string   _data    = LuaAPI.lua_tostring(L, 3);
                    string   _command = LuaAPI.lua_tostring(L, 4);
                    string[] _args    = translator.GetParams <string>(L, 5);

                    ToLuaUtility.HttpPostRequest(_url, _callback, _data, _command, _args);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }