// Update is called once per frame void HandleLog(string log, string strackTrace, LogType type) { LoggerLine line = new LoggerLine(type, log); _transcript.Add(line); UpdateUITranscript(); }
private string FormatLog(LoggerLine line) { string color = "#59E396"; switch (line.type) { case "Log": color = "#BFBFBF"; break; case "Assert": color = "#FF8940"; break; case "Warning": color = "#FFD770"; break; case "Error": color = "#FF405F"; break; case "Exception": color = "#FF8940"; break; } return("<color=" + color + ">[" + line.type + "] : " + line.log + "</color>\n\n"); }
private void refreshConsole() { if (Logger.Lines.Count == 0) { return; } StringBuilder sb = new StringBuilder(); int i = Logger.Lines.Count - 1; int k = 0; int minSeverity; if (!int.TryParse(tbSeverity.Text, out minSeverity)) { minSeverity = 0; } while (i >= 0 && k < 500) { LoggerLine line = Logger.Lines[i]; if (line.Severity >= minSeverity) { sb.AppendFormat("{0:dd/MM/yyyy HH:mm:ss}\t{1}\t{2}\r\n", line.Time, line.Severity, line.Message); k++; } i--; } try { BeginInvoke(new Action <string>(setText), sb.ToString()); } catch (InvalidOperationException) { try { setText(sb.ToString()); } catch (InvalidOperationException) { } } }
private void UpdateUITranscript() { VRUILogs.text = ""; int logsAdded = 0; for (int l = _transcript.Count - 1; l >= 0; l--) { if (logsAdded < LoggerLength) { LoggerLine line = _transcript[l]; if (ShowLog(line)) { VRUILogs.text = VRUILogs.text + FormatLog(line); logsAdded++; } } else { break; } } }
private bool ShowLog(LoggerLine line) { switch (line.type) { case "Log": return(IncludeLogs); case "Assert": return(IncludeAsserts); case "Warning": return(IncludeWarnings); case "Error": return(IncludeErrors); case "Exception": return(IncludeExceptions); default: return(false); } }