Skip to content

Conversation

@WA11AX
Copy link
Owner

@WA11AX WA11AX commented Aug 13, 2025

Summary

  • replace console logging in server with structured logger
  • use toast notifications in client instead of alerts and confirms
  • strip console debug output from tests

Testing

  • npm run lint

https://chatgpt.com/codex/tasks/task_e_689c181f742c83279276402524062dd6

Copilot AI review requested due to automatic review settings August 13, 2025 04:51
Copy link
Contributor

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 refactors debug and console logging across the application by replacing console statements with structured logging and user-friendly notifications.

  • Replace console.log/error calls with structured logger in server-side code
  • Convert client-side alerts and console statements to toast notifications
  • Remove debug console output from test files

Reviewed Changes

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

Show a summary per file
File Description
tests/example.test.ts Remove console debug statements from mock test runner
server/vite.ts Replace console.log with structured logger.info
server/storage.ts Replace console.error with logger.error including context
server/routes.ts Replace console statements with appropriate logger methods
server/middleware.ts Replace console statements with structured logging
server/db.ts Replace console statements with logger methods for database operations
server/config.ts Replace console.error/log with logger methods for configuration
server/auth.ts Replace console statements with logger methods for authentication
client/src/lib/telegram.ts Replace console statements and alerts with toast notifications
client/src/components/error-boundary.tsx Replace console.error with toast notification in error handler

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
console.error("ErrorBoundary caught an error:", error, errorInfo);
override componentDidCatch(error: Error, _errorInfo: React.ErrorInfo) {
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The _errorInfo parameter is now unused but could be valuable for debugging. Consider including error stack trace or component stack information in the toast notification for better error reporting.

Copilot uses AI. Check for mistakes.
console.error("Failed to show alert:", error);
alert(message);
toast({ variant: "destructive", description: "Failed to show alert" });
toast({ description: message });
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

This error handling shows two consecutive toast notifications - one for the failure and one for the original message. This could be confusing to users. Consider combining them into a single toast or logging the original error details.

Suggested change
toast({ description: message });
toast({ variant: "destructive", description: `Failed to show alert: ${message}` });
if (error) console.error("showAlert error:", error);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants