Skip to content

Allow log level to be overridden per file #901

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

apiology
Copy link
Contributor

@apiology apiology commented Apr 18, 2025

Useful for debug-level logging being turned on selectively at dev time

The idea here is that we could have code like this:

class SomeRandomClass
  def important_method
    data = logic
    logger.debug { "something happened: #{data}" }
    logic
  end
  
  include Logging
end

We can selectively turn on those debugging lines at dev time by temporarily adding a log_level method:

class SomeRandomClass

  def log_level
    :debug
  end
  
  def important_method
    data = logic
    logger.debug { "something happened: #{data}" }
    logic
  end
  
  include Logging
end

As a result, only the debug lines we care about are brought in while debugging something that interacts with SomeRandomClass

Useful for debug-level logging being turned on selectively at dev time
@apiology apiology marked this pull request as draft April 21, 2025 03:04
@apiology apiology marked this pull request as ready for review April 21, 2025 11:20
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.

1 participant