Class PlayerLogImporter
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Fills a new player history from the logs the server already kept, once.
public static class PlayerLogImporter
- Inheritance
-
PlayerLogImporter
- Inherited Members
Remarks
So the Players tab does not start empty on a server that has been running for months. The server
keeps its own logs in logs/: one gzipped file per start or per day
(2026-09-18-1.log.gz) and the current one, latest.log. Every line goes through the
same PlayerEventParser as the live console.
A log line carries only the time of day, so the date comes from the file. A gzipped log's name
starts with the day it began. latest.log has no date in its name: its last write is the
day it ended, and every time the clock goes backwards between two lines a midnight was crossed,
so the day it began is that many days earlier.
latest.log is skipped while the server runs: the live console is recording those very
lines at the same moment.
Methods
ImportOnce(string, PlayerHistoryStore, bool, CancellationToken)
Imports the server's logs into store, unless that was done already.
public static int ImportOnce(string serverFolder, PlayerHistoryStore store, bool serverRunning, CancellationToken ct = default)
Parameters
serverFolderstringstorePlayerHistoryStoreserverRunningboolctCancellationToken
Returns
- int
How many events were read (duplicates included, those are dropped by the store).