Skip to main content

ConsoleTokenLog

A internal static class in TavernLib, TavernLib.Backend.RemoteConsole. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Internal: writes console_token_log.jsonl, one JSON line per console connect, disconnect, command and refused login. Never a token's text; rolls to .1 past 5 MB.

Fields​

5 private and internal fields
MemberWhat it is
private static readonly string FilePathPath of console_token_log.jsonl in the ModdingTavern folder.
private const int MaxCommandLengthLongest command text, in characters, that is kept in a log line.
private const long RollAtSize in bytes (5 MB) past which console_token_log.jsonl is moved to .1 and a new file started.
private static readonly object SyncLock held while the log is written or read.
private static readonly Regex TokenTextRegex that matches anything shaped like a token, so Redact can replace it.

Methods​

MemberWhat it is
static string Redact(string text)Replaces anything shaped like a token in the text with [token].
static List<JObject> Tail(string tokenId, int count)The newest entries, oldest first, for one token id (owner for the owner token) or all of them.
static void Write(string type, string tokenId, string address, string command = null, string result = null, string reason = null)Appends one entry with the time, event, token id and name, address, and the redacted command, result or reason.