Skip to content

🧹 Centralize backend logging#11

Merged
davidraehles merged 3 commits intomainfrom
code-health-centralize-logging-11759547853024196223
Feb 18, 2026
Merged

🧹 Centralize backend logging#11
davidraehles merged 3 commits intomainfrom
code-health-centralize-logging-11759547853024196223

Conversation

@davidraehles
Copy link
Copy Markdown
Collaborator

🎯 What: Replaced direct console.log and console.error usage in the backend with a centralized logger utility in backend/src/utils/logger.ts.
💡 Why: This improves maintainability by providing a single point of control for logging, making it easier to swap or configure logging libraries in the future.
Verification:

  • Created backend/src/utils/logger.ts and verified its content.
  • Replaced all direct console. calls in notes.ts, auth.ts, and server.ts.
  • Verified replacements with grep.
  • Confirmed logger.ts compiles with tsc.
  • Ran pnpm run build in backend/ (after generating Prisma client).
    Result: Backend logging is now standardized and easier to manage.

PR created automatically by Jules for task 11759547853024196223 started by @davidraehles

Replaced direct console.log and console.error usage with a centralized
logger utility in backend/src/utils/logger.ts. This improves
maintainability and provides a single point of control for logging.

Co-authored-by: davidraehles <6085055+davidraehles@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 18, 2026 19:33
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes backend logging by introducing a logger utility wrapper and replacing all direct console.log and console.error calls throughout the backend codebase. The change improves maintainability by providing a single point of control for logging configuration. Additionally, the PR introduces a pnpm-lock.yaml file, suggesting a migration from npm to pnpm as the package manager.

Changes:

  • Created centralized logger utility in backend/src/utils/logger.ts with info, error, warn, and debug methods
  • Replaced direct console calls with logger utility imports across backend routes and server
  • Added pnpm-lock.yaml lockfile to the backend directory

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/src/utils/logger.ts New centralized logger utility wrapping console methods (info, error, warn, debug)
backend/src/server.ts Replaced console.log with logger.info for server startup message
backend/src/routes/notes.ts Replaced all console.error calls with logger.error in error handlers
backend/src/routes/auth.ts Replaced all console.error calls with logger.error in error handlers
backend/pnpm-lock.yaml Added pnpm lockfile (1443 lines) indicating package manager change
Files not reviewed (1)
  • backend/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/pnpm-lock.yaml Outdated
Comment on lines +1 to +6
lockfileVersion: '9.0'

settings:
autoInstallPeers: true
excludeLinksFromLockfile: false

Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces pnpm-lock.yaml alongside the existing package-lock.json file. Having both lockfiles can lead to inconsistencies and confusion about which package manager should be used. The repository should standardize on either npm or pnpm.

If migrating to pnpm:

  • Remove package-lock.json from backend/ and frontend/
  • Add .npmrc with shamefully-hoist=true or similar pnpm configuration if needed
  • Document the change in the project README
  • Update CI/CD pipelines to use pnpm

If staying with npm:

  • Remove this pnpm-lock.yaml file
  • Continue using package-lock.json

Note: The PR description mentions running "pnpm run build" which suggests pnpm is intended, but the existing package-lock.json files indicate the project was using npm previously.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed pnpm-lock.yaml from the branch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed backend/pnpm-lock.yaml as requested.

Comment thread backend/src/utils/logger.ts Outdated
Comment on lines +5 to +17
export const info = (message: string, ...args: any[]) => {
console.log(message, ...args);
};

export const error = (message: string, ...args: any[]) => {
console.error(message, ...args);
};

export const warn = (message: string, ...args: any[]) => {
console.warn(message, ...args);
};

export const debug = (message: string, ...args: any[]) => {
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger functions use any[] for the rest parameter which bypasses TypeScript's type safety. Consider using unknown[] instead to maintain type safety while still allowing flexibility. This prevents potential issues where incorrect types are passed to the logger.

Example:

export const info = (message: string, ...args: unknown[]) => {
  console.log(message, ...args);
};

This is a minor improvement that would make the logger more type-safe while maintaining the same functionality.

Suggested change
export const info = (message: string, ...args: any[]) => {
console.log(message, ...args);
};
export const error = (message: string, ...args: any[]) => {
console.error(message, ...args);
};
export const warn = (message: string, ...args: any[]) => {
console.warn(message, ...args);
};
export const debug = (message: string, ...args: any[]) => {
export const info = (message: string, ...args: unknown[]) => {
console.log(message, ...args);
};
export const error = (message: string, ...args: unknown[]) => {
console.error(message, ...args);
};
export const warn = (message: string, ...args: unknown[]) => {
console.warn(message, ...args);
};
export const debug = (message: string, ...args: unknown[]) => {

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed all rest parameter types from any[] to unknown[] for stricter type safety.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed rest parameter types from any[] to unknown[] for better type safety.

OpenCode and others added 2 commits February 18, 2026 21:17
- Removed backend/pnpm-lock.yaml
- Updated logger rest parameters to use unknown[] instead of any[]

Co-authored-by: davidraehles <6085055+davidraehles@users.noreply.github.com>
@davidraehles davidraehles merged commit ece4bf4 into main Feb 18, 2026
davidraehles added a commit that referenced this pull request Feb 18, 2026
…6-7-8-10-11-12-13-14

Merge PRs #1, #2, #3, #4, #5, #6, #7, #8, #10, #11, #12, #13, #14 into main
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.

3 participants