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; } }
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); } }
private void OnLogOccur(Logger.LogDetail logDetail) { if (null != logDetail) { m_lstLogDetail.Add(logDetail); RefreshView(); AppendToFile(logDetail); } }
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); }