Skip to content
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

Improve logging #163

Closed
wants to merge 0 commits into from
Closed

Improve logging #163

wants to merge 0 commits into from

Conversation

gregemax
Copy link

@gregemax gregemax commented Sep 21, 2024

Summary
This PR introduces the debug mode logging functionality for the Logger utility. When DEBUG_MODE is set to true, the Logger will output additional debug logs, helping developers track detailed log information during development.

Changes Introduced

  • Added a check for process.env.DEBUG_MODE in the Logger.debug method.
  • Implemented two unit tests:
    • One to verify that no logs are printed when DEBUG_MODE=false.
    • Another to verify that logs are printed with the correct format when DEBUG_MODE=true.
  1. Set DEBUG_MODE=true in your environment.
  2. Use the Logger.debug() method to log messages and ensure they appear in the console.
  3. Set DEBUG_MODE=false and ensure no debug messages are printed.
  4. Run pnpm test to verify that all unit tests pass.

Copy link
Member

@d-roak d-roak left a comment

Choose a reason for hiding this comment

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

Hey! Thank you so much for the contribution!

Some considerations:

  • The logger should be able to run on the browser (you can't use fs) and on the cli
  • It should be configurable with our current config file structure, or when passing the configuration in the node constructor
  • We REALLY don't want to "reinvent the wheel" and maintain our own logger if there are alternatives (if we don't have an alternative, we can go with it)
  • We want to have different levels of verbosity (ie. info, debug, error, etc etc)
  • In the browser, the logs should be nested

Suggestions:

If you need further clarifications or have any questions, please send us a message on our tg or discord, we answer pretty fast there

Copy link
Member

Choose a reason for hiding this comment

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

this file shouldn't be in the repo

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.

2 participants