示例#1
0
    protected void AddLog(object msg, Enum_LogType logType = Enum_LogType.Inf, Enum_LogTag tag = Enum_LogTag.All, bool isProtoMsg = false, bool isDirect = true)
    {
        if (!AddLogCheck(logType, tag))
        {
            return;
        }

        LogItem.LogInfo info = new LogItem.LogInfo();
        info.m_LogType = logType;
        info.m_LogTag  = tag;
        if (isProtoMsg)
        {
            info.m_Msg = HandleProtoMsg(msg);
        }
        else
        {
            info.m_Msg = HandleInfo(msg);
        }
        info.m_Time = DateTime.Now.ToString("HH:mm:ss");
        if (isDirect && m_TraceLev != TraceLev.None)
        {
            info.m_Trace = StackTraceUtility.ExtractStackTrace();
            if (m_TraceLev == TraceLev.Simple)
            {
                int idx = info.m_Trace.IndexOf("UnityEngine.");
                if (idx != -1)
                {
                    info.m_Trace = info.m_Trace.Substring(0, idx);
                }
            }
        }

        if (m_OutScreen == true)
        {
            AddToScreen(info);
        }

        if (m_OutFile == true)
        {
            AddToFile(info.ToString());
        }

        if (m_OutConsole && !m_UseMessageReceived)//防止循环
        {
            AddToConsole(info.m_LogType, info.ToString());
        }
    }
示例#2
0
 public void SelectOneLog(object[] args)
 {
     if (!m_Inited)
     {
         return;
     }
     if (args == null || args.Length != 1)
     {
         return;
     }
     LogItem.LogInfo data = (LogItem.LogInfo)args[0];
     m_Text.text  = data.ToString();
     m_Text.color = JerryDebugUGUI.GetLogColor(data.m_LogType);
 }