Changeset 382 for binary-improvements2/MapRendering/Web/API/GetLog.cs
- Timestamp:
- Aug 1, 2022, 12:54:31 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/Web/API/GetLog.cs
r350 r382 2 2 using System.Net; 3 3 using AllocsFixes.JSON; 4 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest; 5 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse; 4 6 5 7 namespace AllocsFixes.NetConnections.Servers.Web.API { … … 9 11 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 10 12 int _permissionLevel) { 11 int count, firstLine, lastLine; 12 13 if (_req.QueryString ["count"] == null || !int.TryParse (_req.QueryString ["count"], out count)) { 13 if (_req.QueryString ["count"] == null || !int.TryParse (_req.QueryString ["count"], out int count)) { 14 14 count = 50; 15 15 } … … 27 27 } 28 28 29 if (_req.QueryString ["firstLine"] == null || !int.TryParse (_req.QueryString ["firstLine"], out firstLine)) { 30 if (count > 0) { 31 firstLine = LogBuffer.Instance.OldestLine; 32 } else { 33 firstLine = LogBuffer.Instance.LatestLine; 34 } 29 if (_req.QueryString ["firstLine"] == null || !int.TryParse (_req.QueryString ["firstLine"], out int firstLine)) { 30 firstLine = count > 0 ? LogBuffer.Instance.OldestLine : LogBuffer.Instance.LatestLine; 35 31 } 36 32 37 33 JSONObject result = new JSONObject (); 38 34 39 List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, count, out lastLine);35 List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, count, out int lastLine); 40 36 41 37 JSONArray entries = new JSONArray (); … … 44 40 entry.Add ("date", new JSONString (logEntry.date)); 45 41 entry.Add ("time", new JSONString (logEntry.time)); 46 entry.Add ("uptime", new JSONString (logEntry.uptime)); 42 entry.Add ("isotime", new JSONString (logEntry.isoTime)); 43 entry.Add ("uptime", new JSONString (logEntry.uptime.ToString ())); 47 44 entry.Add ("msg", new JSONString (logEntry.message)); 48 45 entry.Add ("trace", new JSONString (logEntry.trace));
Note:
See TracChangeset
for help on using the changeset viewer.