source: TFP-WebServer/WebServer/src/SSE/EventLog.cs@ 492

Last change on this file since 492 was 467, checked in by alloc, 15 months ago

21.1.16.2 WebServer release
Added "id"s to messages in log API / event
Added "baseUrl" to mods API for WebMods

File size: 536 bytes
Line 
1using JetBrains.Annotations;
2using Utf8Json;
3using Webserver.UrlHandlers;
4using Webserver.WebAPI.APIs;
5
6namespace Webserver.SSE {
7 [UsedImplicitly]
8 public class EventLog : AbsEvent {
9 public EventLog (SseHandler _parent) : base (_parent, _name: "log") {
10 LogBuffer.EntryAdded += LogCallback;
11 }
12
13 private void LogCallback (LogBuffer.LogEntry _logEntry) {
14 JsonWriter writer = new JsonWriter ();
15 LogApi.WriteLogMessageObject (ref writer, _logEntry);
16
17 SendData ("logLine", writer.ToString ());
18 }
19 }
20}
Note: See TracBrowser for help on using the repository browser.