Skip to content

refactor(logger): bind repeated log context with child loggers#2769

Draft
goastler wants to merge 1 commit into
mainfrom
refactor/logger-with-child-loggers
Draft

refactor(logger): bind repeated log context with child loggers#2769
goastler wants to merge 1 commit into
mainfrom
refactor/logger-with-child-loggers

Conversation

@goastler

Copy link
Copy Markdown
Member

What

Replace places where a logger was passed/held and the same contextual metadata was re-attached on every individual log call with a single child logger created via Logger.with(...), which binds that context once.

Changes

  • databasebase/mongo.ts: bind mongoUrl once in the constructor (was repeated across ~11 connect()/close() log calls).
  • redis-clientredisClient.ts: bind url in connectToRedis and name in setupRedisIndex once each.
  • envprovider.ts: bind failedFuncName once in cleanup() (was duplicated across two error handlers).
  • providerutil.ts: bind challengeIp/providedIp once at the top of deepValidateIpAddress (was repeated across ~7 log calls).

No behavioural change — the same fields are emitted, just bound once instead of inline. Type-checked (build:tsc) for all four packages.

Use Logger.with to bind context once rather than repeating the same
data block in every log call across mongo, redis-client, env startup
cleanup, and provider IP validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant