Changeset 369 for binary-improvements/MapRendering/Web/LogBuffer.cs
- Timestamp:
- Nov 9, 2021, 6:28:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/LogBuffer.cs
r350 r369 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Text.RegularExpressions;4 3 using UnityEngine; 5 4 … … 8 7 private const int MAX_ENTRIES = 3000; 9 8 private static LogBuffer instance; 10 11 private static readonly Regex logMessageMatcher =12 new Regex (@"^([0-9]{4}-[0-9]{2}-[0-9]{2})T([0-9]{2}:[0-9]{2}:[0-9]{2}) ([0-9]+[,.][0-9]+) [A-Z]+ (.*)$");13 9 14 10 private readonly List<LogEntry> logEntries = new List<LogEntry> (); … … 23 19 24 20 private LogBuffer () { 25 Log ger.Main.LogCallbacks+= LogCallback;21 Log.LogCallbacksExtended += LogCallback; 26 22 } 27 23 … … 72 68 } 73 69 74 private void LogCallback (string _ msg, string _trace, LogType _type) {70 private void LogCallback (string _formattedMsg, string _plainMsg, string _trace, LogType _type, DateTime _timestamp, long _uptime) { 75 71 LogEntry le = new LogEntry (); 76 72 77 Match match = logMessageMatcher.Match (_msg); 78 if (match.Success) { 79 le.date = match.Groups [1].Value; 80 le.time = match.Groups [2].Value; 81 le.uptime = match.Groups [3].Value; 82 le.message = match.Groups [4].Value; 83 } else { 84 DateTime dt = DateTime.Now; 85 le.date = string.Format ("{0:0000}-{1:00}-{2:00}", dt.Year, dt.Month, dt.Day); 86 le.time = string.Format ("{0:00}:{1:00}:{2:00}", dt.Hour, dt.Minute, dt.Second); 87 le.uptime = ""; 88 le.message = _msg; 89 } 90 73 le.date = $"{_timestamp.Year:0000}-{_timestamp.Month:00}-{_timestamp.Day:00}"; 74 le.time = $"{_timestamp.Hour:00}:{_timestamp.Minute:00}:{_timestamp.Second:00}"; 75 le.uptime = _uptime.ToString (); 76 le.message = _plainMsg; 91 77 le.trace = _trace; 92 78 le.type = _type;
Note:
See TracChangeset
for help on using the changeset viewer.