Ignore:
Timestamp:
Nov 9, 2021, 6:28:33 PM (3 years ago)
Author:
alloc
Message:

Preparations for A20 release
Changes usage of "SteamID" to "UserID" in console commands
Also changes a bunch of the WebAPI stuff to show / use UserIDs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/MapRendering/Web/LogBuffer.cs

    r350 r369  
    11using System;
    22using System.Collections.Generic;
    3 using System.Text.RegularExpressions;
    43using UnityEngine;
    54
     
    87                private const int MAX_ENTRIES = 3000;
    98                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]+ (.*)$");
    139
    1410                private readonly List<LogEntry> logEntries = new List<LogEntry> ();
     
    2319
    2420                private LogBuffer () {
    25                         Logger.Main.LogCallbacks += LogCallback;
     21                        Log.LogCallbacksExtended += LogCallback;
    2622                }
    2723
     
    7268                }
    7369
    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) {
    7571                        LogEntry le = new LogEntry ();
    7672
    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;
    9177                        le.trace = _trace;
    9278                        le.type = _type;
Note: See TracChangeset for help on using the changeset viewer.