|
Last change
on this file since 410 was 369, checked in by alloc, 4 years ago |
|
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 size:
1.0 KB
|
| Rev | Line | |
|---|
| [367] | 1 | using System;
|
|---|
| 2 | using AllocsFixes.JSON;
|
|---|
| 3 | using UnityEngine;
|
|---|
| 4 |
|
|---|
| 5 | namespace AllocsFixes.NetConnections.Servers.Web.SSE {
|
|---|
| 6 | public class EventLog : EventBase {
|
|---|
| 7 | public EventLog (SseHandler _parent) : base (_parent, _name: "log") {
|
|---|
| [369] | 8 | Log.LogCallbacksExtended += LogCallback;
|
|---|
| [367] | 9 | }
|
|---|
| 10 |
|
|---|
| [369] | 11 | private void LogCallback (string _formattedMsg, string _plainMsg, string _trace, LogType _type, DateTime _timestamp, long _uptime) {
|
|---|
| 12 | string date = $"{_timestamp.Year:0000}-{_timestamp.Month:00}-{_timestamp.Day:00}";
|
|---|
| 13 | string time = $"{_timestamp.Hour:00}:{_timestamp.Minute:00}:{_timestamp.Second:00}";
|
|---|
| 14 | string uptime = _uptime.ToString ();
|
|---|
| 15 | string message = _plainMsg;
|
|---|
| [367] | 16 |
|
|---|
| 17 | JSONObject data = new JSONObject ();
|
|---|
| 18 | data.Add ("msg", new JSONString (message));
|
|---|
| 19 | data.Add ("type", new JSONString (_type.ToStringCached ()));
|
|---|
| 20 | data.Add ("trace", new JSONString (_trace));
|
|---|
| 21 | data.Add ("date", new JSONString (date));
|
|---|
| 22 | data.Add ("time", new JSONString (time));
|
|---|
| 23 | data.Add ("uptime", new JSONString (uptime));
|
|---|
| 24 |
|
|---|
| 25 | SendData ("logLine", data);
|
|---|
| 26 | }
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.