Skip to content

feat(extension): implement development-only logger with debug toggle #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2025

Conversation

daymade
Copy link
Contributor

@daymade daymade commented May 24, 2025

Summary

This PR implements a development-only logging system for the Refly Chrome extension to eliminate console spam in production while maintaining debugging capabilities during development.

Fixes #941

Impact Areas

Please check the areas this PR affects:

  • Multi-threaded Dialogues
  • AI-Powered Capabilities (Web Search, Knowledge Base Search, Question Recommendations)
  • Context Memory & References
  • Knowledge Base Integration & RAG
  • Quotes & Citations
  • AI Document Editing & WYSIWYG
  • Free-form Canvas Interface
  • Other (Chrome Extension Console Logging & Debug System)

Screenshots/Videos

Before After
https://screen.studio/share/x1IkbtXH https://screen.studio/share/XcXfWX0I

Checklist

  • This change requires a documentation update, included: Refly Documentation
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

- Create DevLogger utility to eliminate console spam in production

- Add 10-click debug activation (click floating sphere logo 10 times)

- Replace console.log with logger.debug() throughout extension

- Support multiple debug activation methods (localStorage, URL params, etc.)

- Maintain clean console for users while preserving debug capabilities

- Reorganize logger code for better maintainability

Files changed:

- NEW: apps/extension/src/utils/logger.ts - Core logger utility

- Modified: floatingSphere App.tsx - Added debug click handler

- Modified: Various background events - Replaced console logging

- Modified: Content selector hooks - Replaced debug logging

Fixes console spam issue and improves user experience.
@pftom
Copy link
Contributor

pftom commented May 27, 2025

@daymade thanks! We will review this pr later 😆

Copy link
Contributor

@mrcfps mrcfps left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@daymade
Copy link
Contributor Author

daymade commented Jun 6, 2025

Thank you @mrcfps, I have fixed the lint error.

@mrcfps mrcfps merged commit b802b8f into refly-ai:main Jun 8, 2025
1 check passed
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.

The chrome extension continue logs messages in console
3 participants