Repository navigation
Structured (one-line) server logs when not attached to a TTY #20439
colonelpanic8
started this conversation in
Ideas
Replies: 1 comment
|
Opened #20532 with an implementation: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The server always logs through
Logger.consolePretty()(apps/server/src/serverLogger.ts). That works well in a terminal. But the server also runs as a service, both throught3 service installand in hand-written systemd units, and there nothing reads its stdout in a terminal. The output goes to journald or to theStandardOutput=append:log file, and the pretty format gets in the way there.What it looks like under systemd:
journalctl -g,-pand-o jsoncan't see the message and its fields together, and a log file is just as hard to parse.journalctl -p warningcan't separate the WARN lines from the rest.The trace NDJSON doesn't cover this. It holds spans, and
Logger.tracerLoggeronly records messages logged inside a recorded span, so top-level messages such as startup, auth rejections and scope setup only ever reach stdout in the pretty format.#1065 asked for pino and was closed with "we use effect/Logger". This doesn't need a different library: Effect 4.0.5 already ships
Logger.consoleJsonandLogger.consoleLogFmt. The proposal is to choose between them:logFormatoption (pretty | logfmt | json) next tologLevelin server.json, plus an env var.prettyif stdout is a TTY and a one-line format otherwise.t3 service installeither rely on that default or setjsonexplicitly.t3 pair.Logs are also what agents read when they debug T3 Code, which matters more now that
t3 triageexists. One record per event is what they parse reliably.I'm happy to send a PR if this direction sounds right.
All reactions