Skip to content

Device log

The device log is the record of what a TriggerGate device did and was asked to do: the edges it reported, the commands clients sent it, faceoffs, health checks, connections, and the rest of what the device writes to its own log. You can download any part of it, bounded by a start and an end time, from the web page or from a .NET client, for example to find out what happened during one game. It is available on the Windows and Uno service and on the ESP32.

What the log is and where it lives

On the .NET service (Windows and Uno) the device log is the service's own log. There is one file per UTC day, named yyyy-MM-dd.log, in:

Platform Folder
Windows %ProgramData%\GameshowPro\TriggerGate\logs
Uno /var/lib/GameshowPro/TriggerGate/logs

Nothing is copied or kept separately. A download reads these files while the service keeps writing to them, and it never blocks the service's logging.

A new file starts at midnight UTC, not local midnight. The service keeps four files, including today's, so the log reaches back about three full days plus the part of today that has passed. When a new day starts, the oldest file is deleted. Download what you need soon after an event, not at the end of the week. Restarting the service does not clear the log.

On the ESP32 the log is a ring in memory that holds the most recent 128 entries, within 16 KiB of text. Older entries are overwritten, and the whole log is lost when the device restarts.

What it records

On the .NET service every level is recorded, down to Trace. What the service writes is set by NLog.config, next to the service program, which sends every level to the log file; the Logging section of appsettings.json does not filter it. For a download you choose the lowest level you want, and the web page offers Information by default, which is the level of the events below.

  • Edges. One Information line for each edge reported to clients: the input, its direction, whether it came from an interrupt or from polling, its place in the faceoff (the ordinal in the line is zero-based: 0 is 1st), the faceoff time, the lockout remaining, the edge's own UTC time, and whether it was a test edge. The line is queued after the edge is handed to SignalR and written by a background thread, normally within a few tens of milliseconds. The time column is therefore later than the edge, and a command line written meanwhile can come before the lines of edges that happened just before it. For the moment the edge happened, read "edge time" in the message. If the queue were ever full, the lines that did not fit would be missing, and one warning, written when it has emptied, says how many.
  • Commands. One line for each hub command a client sends: preparing, starting and ending a faceoff, random test triggers, changing settings, running an OSC or lighting action, and the button health check commands. Each line names the connection that sent it, the parameters and the outcome. A command that changes something is logged at Information when it succeeds and at Warning when it fails. A command that only reads something, including a download of this log, is logged at Debug. A command that throws is logged at Error with the exception.
  • Faceoff and health check events. A faceoff the service cancels by itself, with the reason; the settings in force after a change; the faceoff health report when a faceoff is cleared and when a pre-faceoff ends ("Faceoff health" or "Pre-faceoff health", a warning when an input had stray interrupts; see Input diagnostics); and the start and end of a button health check, with any problems found. An interrupt or polled change the service ignores (debounced, suppressed, not armed) has no line of its own.
  • Connections. One line when a client connection is opened, with its address and what it is bound to, and one when it closes, with the error if there was one.
  • Everything else the service logs: start-up, platform selection, clock status and steps, device changes, and warnings and errors from any part of the service.

The ESP32 log holds the edge lines, a line for each faceoff and pre-faceoff that ends, the tie decisions of faceoffs, clock status and wall-clock steps, the settings in force, and the firmware's own messages.

The source column holds the name of the logger that wrote the line, so you can tell the hub's lines from the platform's.

Downloading from the web page

When the device supports it, the log panel on the main page has a Download device log… button. It opens a dialog in which you choose the period (a start and an end in your local time, with presets for the last 5 minutes, 15 minutes, hour and today, and an option to run until now) and the lowest level to include. The dialog shows the range the device can still provide and any note the device gives about how far back it goes. It shows progress while the pages are fetched, lets you cancel, and then saves the result as a text file in the format below. If the device's horizon cuts into the period you asked for, the dialog says so. A download that grows past 50 MB is stopped with a message rather than filling the browser's memory; the file keeps what was fetched and says it is incomplete. The dialog does not close with Escape or by clicking outside it, because closing cancels a download in progress.

A download does not interrupt the device. Each page is a separate, small request, and the device reads only as much of its log as it needs for that page.

File format

The file is UTF-8 text. Each entry is one line with four tab-separated columns:

time <TAB> source <TAB> LEVEL <TAB> message
  • The time is UTC with microseconds and ends in Z, for example 2026-11-24 14:03:22.123456Z. It is when the line was written, on the device's clock. An ESP32 entry written while the device has no wall clock shows its time since boot instead, as +seconds.fraction s.
  • The source is the logger that wrote the line.
  • The level is TRACE, DEBUG, INFO, WARN, ERROR or FATAL.
  • The message follows. If the entry has several lines (an exception, for example), the further lines belong to the same entry. A message longer than 16 KiB (4 KiB on the ESP32) is cut and ends with a marker such as [... cut: the message is over 16 KiB].

The file made by the web page adds lines that start with # around the entries. Four header lines name the device, the period and level asked for, the range the device had available, and when the download was made. One final line says whether the download is complete, how many entries it holds and the times of the first and last. A download that was canceled, failed or stopped at the 50 MB size limit ends with # incomplete: and the reason, and keeps what was fetched. A file written by DownloadDeviceLog (below) has only entries.

# TriggerGate device log: STUDIO-PC (Advantech)
# requested: 2026-11-24 22:15:00.000000Z to 2026-11-24 22:25:00.000000Z (UTC, end exclusive), level INFO and above
# available on the device: 2026-11-21 00:00:08.259284Z to 2026-11-24 22:24:58.000664Z; ...
# downloaded: 2026-11-24 22:25:00.148000Z (UTC); entry lines: utc<TAB>source<TAB>LEVEL<TAB>message
...
# complete: 71 entries, first 2026-11-24 22:15:02.118004Z, last 2026-11-24 22:24:41.530912Z

Example (each message starts with the name of the platform instance it concerns, here AdvantechWindows):

2026-11-24 14:03:21.870413Z GameshowPro.TriggerGate.Service.SignalR.TriggerHub  INFO    AdvantechWindows: ResetFaceoff from connection x7Qk2Ab9dEf1: start a faceoff on inputs 0,1,2 rising, edges Interrupt; succeeded
2026-11-24 14:03:22.431180Z GameshowPro.TriggerGate.Service.Sys INFO    AdvantechWindows: edge reported: input 1 rising, interrupt, ordinal 0, faceoff time 00:00:00.8203120, lockout remaining none, edge time 2026-11-24 14:03:22.4306340Z
2026-11-24 14:03:22.431902Z GameshowPro.TriggerGate.Service.Sys INFO    AdvantechWindows: edge reported: input 2 rising, interrupt, ordinal 1, faceoff time 00:00:00.8204410, lockout remaining none, edge time 2026-11-24 14:03:22.4307630Z
2026-11-24 14:03:27.115560Z GameshowPro.TriggerGate.Service.SignalR.TriggerHub  INFO    AdvantechWindows: ResetFaceoff from connection x7Qk2Ab9dEf1: end the faceoff; succeeded
2026-11-24 14:03:41.002317Z GameshowPro.TriggerGate.Service.SignalR.TriggerHub  INFO    AdvantechWindows: connection x7Qk2Ab9dEf1 closed

The layout is the service's own, minus its separate exception column, so a download reads like the service's log files.

Entries are written in time order, except that two threads can write a few milliseconds out of order, because an event is stamped before it is written. The .NET service allows for this: it begins its search 2 seconds before the start of the period and stops 2 seconds after its end, and it returns exactly the entries whose time lies in the period.

.NET client API

TriggerClient (namespace GameshowPro.TriggerGate.Client) has three methods. Against a server that has no device log, they return an unsuccessful response rather than throwing.

using System.Text;
using GameshowPro.TriggerGate;
using GameshowPro.TriggerGate.Model;

// What the device keeps, and how far back it goes.
TriggerCommandResponse<DeviceLogInfo> info = await client.GetDeviceLogInfo();
if (!info.Success || info.Payload is not { Supported: true } log)
{
    Console.WriteLine($"No device log: {info.StatusDescription}");
    return;
}
Console.WriteLine($"Oldest entry {log.OldestUtcTicks}, newest {log.NewestUtcTicks} (UTC ticks). {log.Note}");

// Download the last hour, Information and above, into a file.
DateTime end = DateTime.UtcNow;
using StreamWriter writer = new("device-log.txt", append: false, new UTF8Encoding(false));
DeviceLogDownloadResult result = await client.DownloadDeviceLog(
    end.AddHours(-1), end, DeviceLogLevel.Information, writer,
    new Progress<DeviceLogDownloadProgress>(p => Console.WriteLine($"{p.EntriesWritten} entries, to {p.LastEntryUtc:u}")));
Console.WriteLine(result.Succeeded
    ? $"Wrote {result.EntriesWritten} entries{(result.HorizonPassed ? "; some were lost to the log's horizon" : "")}."
    : result.Cancelled ? "Canceled." : result.Failure);
  • GetDeviceLogInfo() (or with a GetDeviceLogInfoRequest) returns TriggerCommandResponse<DeviceLogInfo>.
  • GetDeviceLog(GetDeviceLogRequest) returns one page, as TriggerCommandResponse<DeviceLogPage>. Use it to page by yourself.
  • DownloadDeviceLog(DateTime? startUtc, DateTime? endUtc, DeviceLogLevel minLevel, TextWriter writer, IProgress<DeviceLogDownloadProgress>? progress = null, CancellationToken cancellationToken = default) pages from the first page to the last and writes one line per entry. A null start or end leaves that side unbounded. What was written stays written when a page fails or the download is canceled. Exceptions from the writer are not caught. The result, DeviceLogDownloadResult, has EntriesWritten, HorizonPassed, Completed, Cancelled, Failure and Succeeded (the same as Completed).

DeviceLogDownloader.DownloadAsync in the common library does the same for any page source (you pass a function that fetches one page), so it can be used with a direct SignalR connection or tested without a hub. DeviceLogText.FormatLine(entry) formats one entry as a line of the file format, and DeviceLogText.LevelName(level) gives the level name.

Hub contract

The commands are GetDeviceLogInfo and GetDeviceLog on ITriggerHubCommands. Their types are in the Common library's GameshowPro.TriggerGate.Model namespace: MessagePack records with explicit keys, times as long .NET ticks (100 ns) of a UTC DateTime, and enums as explicit integers. A platform that has no device log answers Unsupported, which is also what the default implementation returns.

DeviceLogInfo describes the log: Failure, Supported, OldestUtcTicks and NewestUtcTicks (null when the log is empty or the times are not known), MaxPageEntries, MaxPageBytes, Persistent (false when the log is held in memory and lost at reboot) and Note (free text about the horizon).

GetDeviceLogRequest has StartUtcTicks (inclusive, null for no lower bound), EndUtcTicks (exclusive, null for no upper bound), Cursor, MaxCount and MinLevel. DeviceLogPage has Failure, Entries, NextCursor and HorizonPassed. DeviceLogEntry has UtcTicks, MonotonicTicks, Level, Source and Message.

  • Order and level. Entries come back in log order. Entries below MinLevel are skipped before the page limits are applied, so a page of Warning entries is not short because Trace entries came first.
  • Cursor. Cursor is null for the first page. A page's NextCursor is what you send as Cursor for the next page, with the same start, end and level. The cursor is opaque: do not parse it or build one. The server keeps no state for a client. A NextCursor of null means this was the last page.
  • Failure. None on success. Unsupported when the platform or server has no log. InvalidOptions when the request is not valid: an end before the start, MaxCount below 1, a level that does not exist, or a cursor the device did not make. Unavailable when the log exists but cannot be read now.
  • HorizonPassed. True when the request's cursor no longer pointed to anything, because the file it was in had been deleted (on the ESP32, because the entries were overwritten or the device restarted). The page then continues from the oldest entry still available that is not before the cursor's position, and entries in between were lost. The flag is not set merely because the period you asked for reaches back further than the log does. To detect that, compare your start with OldestUtcTicks from GetDeviceLogInfo.
  • Levels. Trace 0, Debug 1, Information 2, Warning 3, Error 4, Critical 5. Critical is written FATAL in the file.
  • Entries without a UTC time. A device with no wall clock at that moment can send an entry with a null UtcTicks and a MonotonicTicks instead. The ESP32 does this; the .NET service never does. Such an entry is skipped when the request has a start or end time.

Page limits

.NET service ESP32
Entries per page 500 16
Message text per page 256 KiB 4 KiB
Longest message 16 KiB, then cut 4 KiB, then cut

An entry is never split between pages. The values are also reported in MaxPageEntries and MaxPageBytes.

On the .NET service each call also reads at most 8 MiB of the log past its starting point, so one request cannot hold the service for long. When a stretch of the log has few matching entries, a page can therefore come back with fewer entries than it could hold, or with none, and still have a NextCursor. An empty page with a cursor is normal: keep asking until NextCursor is null. At most two pages are read at once, and other requests wait their turn. DownloadDeviceLog handles all of this, and it ends with a failure if the device ever returns the same cursor twice, since that would never end.

Platform differences

.NET service (Windows, Uno) ESP32
Source The service's log files A ring of recent entries in memory
Persistent Yes, across service restarts No, lost at reboot
Horizon About three full days plus today The last 128 entries, within 16 KiB

On a device that has no device log, GetDeviceLogInfo answers Unsupported and the web page does not offer the download.

Limits and notes

  • An entry that is still being written when its page is read is not returned, and neither is an entry whose last line is unfinished. It appears in a later download.
  • Times are the device's clock, in UTC. A line's time is when it was written, not when the event happened. Lines from two machines are placed on one timeline only as well as their clocks agree.
  • The log reaches back only as far as its files or its ring do. Nothing older can be recovered through this feature.
  • The log is a diagnostic record, not a timing measurement. For the moment of an edge, use the edge's own time.
  • A device's log also holds the lines of a button health check, but the check's own results and trace are read with their own commands, not from this log.
v2.0.62