Skip to content

Comments

feat: make logs visible by default with environment variable controls#41

Merged
theodorDiaconu merged 4 commits intomainfrom
copilot/fix-40
Aug 13, 2025
Merged

feat: make logs visible by default with environment variable controls#41
theodorDiaconu merged 4 commits intomainfrom
copilot/fix-40

Conversation

Copy link
Contributor

Copilot AI commented Aug 13, 2025

This PR addresses a significant developer experience issue where logs were hidden by default, making it difficult for developers to see what's happening during application startup and development.

The Problem

Previously, the Logger's printThreshold was set to null by default, meaning no logs were printed to the console unless explicitly configured. This created a poor developer experience, especially during the "big bang" phase of starting new projects where visibility into what's happening is crucial.

The Solution

Changed Default Behavior: Logs at info level and above are now visible by default, providing immediate feedback without any configuration.

Added Environment Variable Controls for elegant log management:

  • BLUELIBS_DISABLE_LOGS=true - Completely disable all logging output
  • BLUELIBS_LOG_LEVEL=debug - Set specific log level (trace, debug, info, warn, error, critical)

Maintained Full Backward Compatibility: Existing applications that call setPrintThreshold() continue to work unchanged, with manual settings overriding the new defaults.

Examples

// Now works out of the box - no configuration needed
const app = resource({
  dependencies: { logger: globals.resources.logger },
  init: async (_, { logger }) => {
    logger.info("App starting up");     // ✅ Visible by default
    logger.warn("Config deprecated");   // ✅ Visible by default  
    logger.debug("Internal details");   // ❌ Hidden by default
  },
});
# Show detailed framework debug messages
BLUELIBS_LOG_LEVEL=debug node app.js

# Disable logs for production
BLUELIBS_DISABLE_LOGS=true node app.js

# Show only errors and critical issues
BLUELIBS_LOG_LEVEL=error node app.js

Benefits

  • Better DX: New developers see application logs immediately without configuration
  • Framework Transparency: Debug level reveals framework internals for troubleshooting
  • Production Ready: Easy log control via environment variables
  • Zero Breaking Changes: Existing applications continue working unchanged

The implementation includes comprehensive tests covering all scenarios and updated documentation reflecting the new default behavior.

Fixes #40.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Aug 13, 2025

@theodorDiaconu 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits August 13, 2025 11:13
- Change default printThreshold from null to "info" for better DX
- Add BLUELIBS_DISABLE_LOGS environment variable to disable logging
- Add BLUELIBS_LOG_LEVEL environment variable to set specific log level
- Maintain backward compatibility with existing setPrintThreshold() calls
- Add comprehensive tests for new default behavior and environment variables

Co-authored-by: theodorDiaconu <1814863+theodorDiaconu@users.noreply.github.com>
- Update Quick Start section to show which logs are visible by default
- Update Print Threshold section to document environment variable controls
- Add examples of BLUELIBS_DISABLE_LOGS and BLUELIBS_LOG_LEVEL usage
- Clarify default behavior and programmatic overrides

Co-authored-by: theodorDiaconu <1814863+theodorDiaconu@users.noreply.github.com>
Copilot AI changed the title [WIP] feat: isn't it silly that logs are hidden by default? feat: make logs visible by default with environment variable controls Aug 13, 2025
Copilot AI requested a review from theodorDiaconu August 13, 2025 11:19
@theodorDiaconu
Copy link
Collaborator

@copilot let's use the term RUNNER for the process.env . More in-line.

Co-authored-by: theodorDiaconu <1814863+theodorDiaconu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 13, 2025

@copilot let's use the term RUNNER for the process.env . More in-line.

Updated environment variables to use RUNNER_ prefix instead of BLUELIBS_:

  • BLUELIBS_DISABLE_LOGSRUNNER_DISABLE_LOGS
  • BLUELIBS_LOG_LEVELRUNNER_LOG_LEVEL

Changes made in commit 470cf54, including updates to the implementation, tests, and documentation.

@theodorDiaconu theodorDiaconu marked this pull request as ready for review August 13, 2025 17:02
@coderabbitai
Copy link

coderabbitai bot commented Aug 13, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@theodorDiaconu theodorDiaconu merged commit 63d2a22 into main Aug 13, 2025
3 checks passed
@theodorDiaconu theodorDiaconu deleted the copilot/fix-40 branch August 18, 2025 09:43
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.

feat: isn't it silly that logs are hidden by default?

2 participants