Skip to content

Replace remaining console.* calls with the injected Nest Logger #1042

Description

@RUKAYAT-CODER

Overview

The project ships a structured logging setup in src/logging/structured-logging.ts with correlation id propagation, yet several files bypass it. src/email-marketing/automation/automation.service.ts uses console.warn for an unknown action type; src/achievements/achievements.seed.ts uses console.log; and src/slack.service.ts contains three commented-out console.error/console.log lines where error reporting used to be. Output written through console directly does not carry the correlation id, the service name, or the structured fields the log aggregation pipeline under logging/ indexes on, so these events are invisible to log-based alerting and cannot be tied back to a request.

Specifications

Features:

  • All application logging flows through the injected Logger.
  • A lint rule prevents new console.* calls in src/.

Tasks:

  • Replace console.warn in automation.service.ts with this.logger.warn, including the workflow and action identifiers as structured fields.
  • Replace console.log in achievements.seed.ts with a logger instance appropriate to a seed script.
  • Delete the commented-out console lines in slack.service.ts and implement real error logging there.
  • Enable the no-console ESLint rule for src/** with a narrow exception for genuine CLI scripts.

Impacted Files:

  • src/email-marketing/automation/automation.service.ts
  • src/achievements/achievements.seed.ts
  • src/slack.service.ts
  • .eslintrc.js

Acceptance Criteria

  • No console.* call remains in src/ outside explicitly-exempted CLI scripts.
  • The replaced log lines carry correlation ids and structured fields.
  • npm run lint:ci fails on a newly introduced console.log.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions