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

Last change on this file since 472 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
RevLine 
[391]1using JetBrains.Annotations;
[402]2using Utf8Json;
[391]3using Webserver.UrlHandlers;
[467]4using Webserver.WebAPI.APIs;
[391]5
6namespace Webserver.SSE {
7 [UsedImplicitly]
8 public class EventLog : AbsEvent {
9 public EventLog (SseHandler _parent) : base (_parent, _name: "log") {
[467]10 LogBuffer.EntryAdded += LogCallback;
[391]11 }
12
[467]13 private void LogCallback (LogBuffer.LogEntry _logEntry) {
[402]14 JsonWriter writer = new JsonWriter ();
[467]15 LogApi.WriteLogMessageObject (ref writer, _logEntry);
[402]16
17 SendData ("logLine", writer.ToString ());
[391]18 }
19 }
20}
Note: See TracBrowser for help on using the repository browser.