Esempio n. 1
0
        public override void SetData(object data)
        {
            Logger.LogDetail logDetail = data as Logger.LogDetail;
            loggerText.text = logDetail.detail;
            switch (logDetail.level)
            {
            case Logger.LogLevel.INFO:
                infoImg.SetActive(true);
                waringImg.SetActive(false);
                errorImg.SetActive(false);
                break;

            case Logger.LogLevel.WARNING:
                infoImg.SetActive(false);
                waringImg.SetActive(true);
                errorImg.SetActive(false);
                break;

            case Logger.LogLevel.ERROR:
                infoImg.SetActive(false);
                waringImg.SetActive(false);
                errorImg.SetActive(true);
                break;
            }
        }
Esempio n. 2
0
        private void AppendToFile(Logger.LogDetail logDetail)
        {
            string logLine = "<p><font color=\"log_color\">log_content</font></p>\n";
            string color   = "black";

            if (null != m_fileWriter)
            {
                switch (logDetail.level)
                {
                case Logger.LogLevel.INFO:
                    color = "black";
                    break;

                case Logger.LogLevel.WARNING:
                    color = "maroon";
                    break;

                case Logger.LogLevel.ERROR:
                    color = "red";
                    break;
                }
                logLine = logLine.Replace("log_color", color);
                logLine = logLine.Replace("log_content", logDetail.detail);
                m_fileWriter.WriteLine(logLine);
            }
        }
Esempio n. 3
0
 private void OnLogOccur(Logger.LogDetail logDetail)
 {
     if (null != logDetail)
     {
         m_lstLogDetail.Add(logDetail);
         RefreshView();
         AppendToFile(logDetail);
     }
 }
Esempio n. 4
0
        private bool IsLogFiltered(Logger.LogDetail logDetail)
        {
            bool ret = false;

            switch (logDetail.level)
            {
            case Logger.LogLevel.INFO:
                if (m_logInfoEnable)
                {
                    ret = true;
                }
                break;

            case Logger.LogLevel.WARNING:
                if (m_logWaringEnable)
                {
                    ret = true;
                }
                break;

            case Logger.LogLevel.ERROR:
                if (m_logErrorEnable)
                {
                    ret = true;
                }
                break;
            }

            // reg compare
            if (!string.IsNullOrEmpty(m_regEx) && ret)
            {
                Regex regex = new Regex(m_regEx);
                ret = regex.IsMatch(logDetail.userLog);
            }

            return(ret);
        }