server: /join, session cookies, ws auth and gm-key CLI (#17)

This commit is contained in:
2026-11-14 22:13:09 +01:00
parent e612db5826
commit 9d43aef9ed
5 changed files with 815 additions and 21 deletions
+3 -2
View File
@@ -90,7 +90,7 @@ proc quoteValue(v: string): string =
const LevelNames: array[Level, string] = ["DEBUG", "INFO", "WARN", "ERROR"]
proc log*(lg: Logger, level: Level, event: string,
fields: openArray[(string, string)] = []) =
fields: openArray[(string, string)] = []) {.gcsafe.} =
if level < lg.level: return
let stamp = now().utc.format("yyyy-MM-dd'T'HH:mm:ss'Z'")
var raw = stamp & " " & LevelNames[level] & " " & event
@@ -98,4 +98,5 @@ proc log*(lg: Logger, level: Level, event: string,
let v = if isSensitiveField(name): "[redacted]" else: value
raw.add " " & name & "=" & quoteValue(v)
withLock lg.lock:
lg.sink(lg.redactedValue(raw) & "\n")
{.cast(gcsafe).}:
lg.sink(lg.redactedValue(raw) & "\n")