Repository navigation
refactor(web): log one line per request or job with evlog - #459
Merged
Merged
Conversation
Requests and background jobs each write one wide line, and whatever services note along the way joins it with its own fields. Services keep a plain logger, and an AsyncLocalStorage finds the line. Lines go to stdout with their level by name. Railway files stderr under error, and evlog's console output sends warnings there. pino and pino-pretty are gone. The redact list is unchanged.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Coverage Report for apps/localtoolbox
File CoverageNo changed files found.SizeCompared with main. KiB are 1,024 bytes.
|
Coverage Report for apps/web
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bnb
approved these changes
Nov 5, 2026
bnb
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the web app from pino to evlog. A request or background job now writes one line with everything that happened during it, in place of a line per log call. The reasoning and the options turned down are in ADR 0007.
Added:
logger.request()andlogger.job()inlogger.tsopen a line, and anAsyncLocalStoragefinds it, so services keep callinglogger.warn()under either. Each note goes undernoteswith its own fields, because a service'sdidorstatusisn't the request's. evlog's ownlog.warn(message, fields)merges them into the line.app.ts,bootstrap,directory-sync,reindex-shows,notification-delivery,notification-recovery,db-backupandspace-sync(one per space). A job that noted nothing writes no line, so the 15-second timers stay quiet.testing/written-log.ts: a real logger and the lines it wrote to stdout, which every test that reads the log now uses.apps/web/README.md.Changed:
(message, fields), evlog's order, instead of pino's(fields, message).error, and evlog's console output writeswarnto stderr. So lines are written from a drain, withlevelby name as fix(web): write log levels by name #446 did andmessageas Railway reads it.messagejoins every note's message, so a--filterfor "space sync failed", "background task failed" or "bootstrap failed" has the text to match, as it did with a line per note.levelstays a name for@level:warnand@level:error.levelis the line's worst note, and for a request also its status:warnfor a 4xx anderrorfor a 5xx.error, where evlog prints it in full, and its note keeps the message. Later errors stay on their notes.handlenow get a line. They had none.recording,card) in place of a note each.msgismessage,msisdurationMs,nameisservice, andpidandhostnameare gone. Two notes that called something elsestatusnow saychannelStatusandbackfillStatus, sincestatuson a line means the response's.The redact list is unchanged, with the same replacement,
[redacted]. evlog matches a bare key at any depth where pino matched the top level and one level down, and its built-in patterns also mask emails, IP addresses, phone numbers, card numbers, JWTs and bearer tokens in any string, so this redacts more than before. Tests check each key at three depths in the written output, including what an error carries.Removed:
pino,pino-pretty, andcreateLogger'snameandstreamoptions. Other packages still pull pino in through@atproto, but the app no longer depends on it.evlog is on 2.34.0 rather than 2.35.1, which came out on 2026-11-05 and doesn't pass pnpm's release age check yet. The logger is server code: the production build's budget tests pass, and no file in
build/clientnames evlog.evlog's CLI doesn't help here:
evlog initandevlog mapstop with "Could not detect a supported framework" on SvelteKit. The site's audit log stays as it is. It's its own hash-chained store, so evlog'slog.auditwould be a second one.To check after this deploys, once a sync has failed:
railway logs --service localnetwork --lines 20 --filter "@level:warn". The local run can't show Railway reading these lines, only that they're on stdout in the documented shape.