Skip to content

Sixty-five console calls and no structured logger #332

Closed as not planned

Description

@Miracle656

Background

src/ contains 65 console.log / console.warn / console.error calls
outside tests, and zero uses of a logger. Fastify ships pino and already has a
configured logger on every request as req.log, so the dependency is present
and unused.

Practical consequences: no log levels, so nothing can be turned down in
production; no JSON, so a log aggregator cannot index fields; and no correlation
between a line and the request that caused it. When a caller reports a bad price
at 14:03, there is no way to find the work that produced it.

What to build

  • Route logging through pino — req.log inside request handlers, a module-level
    child logger for ingesters and jobs.
  • Give each child logger a stable component name (ingester:amm, job:retention)
    so lines can be filtered by subsystem.
  • Keep the existing [lens] / [amm] prefixes as structured fields rather than
    interpolated text.
  • Make the level configurable by environment variable, defaulting to info.
  • Never log a secret, an API key or a full connection string. This repo has
    leaked a connection string through an error message before.

Acceptance criteria

  • No console.* calls remain in src/ outside tests
  • Log level is configurable and documented in .env.example
  • Logs are JSON in production and human-readable in development
  • Component name is a field, not part of the message text
  • A test asserts that no logger call includes DATABASE_URL or an API key value

Drips Wave · Complexity: Intermediate · 150 points


Repo: Divinity-Labs/Lens. Node + TypeScript, Fastify, Prisma on Postgres,
Redis for queues, Prometheus via prom-client.

Run the tests: npm test. The tests are vitest, not jest. Running jest
against this repo reports "66 suites, 0 tests" and means nothing. A single file
is npx vitest run src/__tests__/yourfile.test.ts.

Load test (prices) is already failing on main and has been for some
time. It is not your PR that broke it. Every other check should be green.

This service prices real assets on Stellar mainnet. A number that is wrong
is worse than a number that is missing, because a caller cannot tell the
difference. Prefer failing loudly over returning a plausible value.

Never elide an address, a contract id or a key in code, a comment or a test
fixture.
A previous batch wrote a shortened contract id in an issue text and
five contributors invented plausible-looking ids to fill the gap. Write the
whole thing or do not write it at all.

The house pattern for an outbound deadline already exists — see
src/alerts/delivery.ts, which passes signal: AbortSignal.timeout(10_000) to
fetch. Where an issue below asks for a timeout, copy that, do not invent a
second convention.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

  1. aliyuHabibu commented on Oct 16, 2026

    @aliyuHabibu
    Contributor

    @aliyuHabibu has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi maintainer, i reviewed the issue and this is exactly the type of work i enjoy, i can deliver a clean, well-tested PR promptly, please assign it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @aliyuHabibu to this issue.

  2. drips-wave commented on Oct 16, 2026

    @drips-wave

    Congratulations, @aliyuHabibu! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @aliyuHabibu: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  3. Miracle656 commented on Oct 16, 2026

    @Miracle656
    CollaboratorAuthor

    @aliyuHabibu — stop before you start, this one is my mistake and I am closing it.

    This issue duplicates #278 "Logs are not structured, so nothing can be queried", published in an earlier batch and already assigned to @jamal-exe. Same work: replacing the console.* calls with pino, which Fastify already ships.

    I published this batch without checking it against the open issues first. That is my failure, not yours, and I am sorry it cost you a claim.

    These went up in the same batch and are unclaimed right now — all independent, all touching different files:

    Closed as a duplicate of #278.

  4. drips-wave commented on Oct 18, 2026

    @drips-wave

    This issue has been marked as completed by a Drips Wave moderator for @aliyuHabibu as part of the Stellar Wave Program's 10th Wave 🥳

    Moderator's reason: [Auto-assessed] PR #402 was merged by maintainer @Miracle656 on 2026-10-18T07:56:30Z, with an explicit approving review praising the implementation of structured logging with pino, secret scrubbing, component-scoped child loggers, and automated tests ensuring no console calls remain.

    😎 @aliyuHabibu: You earned 150 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

    ℹ️ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions