コード例 #1
0
ファイル: DebugManager.cs プロジェクト: zqbb/MxDebug
        private void HandleLog(string condition, string stackTrace, LogType type)
        {
            string time = DateTime.Now.ToString("yyy-MM-dd HH:mm");

            if (type == LogType.Error || type == LogType.Exception)
            {
                string message = string.Format("Error:{0}\nTime:{1}\n{2}", condition, time, stackTrace);
                if (DebugDefine.IsPrintLog)
                {
                    SaveErrorLog(message);
                }
            }

            if (DebugDefine.IsDebugMode)
            {
                DebugData debugData = new DebugData();
                debugData.ID         = stackTrace + GetTimeStamp();
                debugData.Condition  = condition;
                debugData.StackTrace = stackTrace;
                debugData.Type       = type;
                debugData.Tiem       = time;

                SedLogData(debugData);
            }
        }
コード例 #2
0
        /// <summary>发送日记数据</summary>
        private void SedLogData(DebugData debugData)
        {
            string msg = JsonUtility.ToJson(debugData);

            if (m_Client != null)
            {
                m_Client.SendMsg(msg);
            }
        }
コード例 #3
0
        /// <summary>
        /// 发送数据给调试端
        /// </summary>
        /// <param name="debugData">数据内容</param>
        private void SedLogData(DebugData debugData)
        {
            string sendStr = JsonUtility.ToJson(debugData);

            try
            {
                data = new byte[Encoding.UTF8.GetBytes(sendStr).Length];
                data = Encoding.UTF8.GetBytes(sendStr);
                socket.SendTo(data, data.Length, SocketFlags.None, iPEndPoint);
            }

            catch
            {
                Debug.LogWarning(GetType() + "/SedLogData() send debug errror!");
            }
        }
コード例 #4
0
        /// <summary>日记回调</summary>
        private void HandleLog(string condition, string stackTrace, LogType type)
        {
            string time = DateTime.Now.ToString("yyy-MM-dd HH:mm");

            if (type == LogType.Error || type == LogType.Exception)
            {
                string message = string.Format("Error:{0}\nTime:{1}\n{2}", condition, time, stackTrace);
                SaveErrorLog(message);
            }

            DebugData debugData = new DebugData();

            debugData.ID         = stackTrace + TimeUtils.GetTimeStampToMilliseconds();
            debugData.Condition  = condition;
            debugData.StackTrace = stackTrace;
            debugData.Type       = type;
            debugData.Tiem       = time;

            if (m_IsRemoteDebug)
            {
                SedLogData(debugData);
            }
        }