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

Prefer to pass block when logging. #16099

Merged
merged 1 commit into from Jul 18, 2014
Merged

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Jul 9, 2014

end

def unpermitted_parameters(event)
return unless logger.debug?
Copy link
Member

Choose a reason for hiding this comment

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

I think using the block form would be less error prone. Right now, this guard and the following call to debug are directly coupled. If one changes, the other needs to as well. Using the block version, this guard will be done by the Logger. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Should I also standardize this across all the LogSubscribers?

@senny
Copy link
Member

senny commented Jul 18, 2014

@tgxworld looking good. Can you squash the commits?

@tgxworld
Copy link
Contributor Author

@senny sure :) Should I leave the commit messages since it'll provide context on why we're making the changes.

@senny
Copy link
Member

senny commented Jul 18, 2014

@tgxworld sure, they all belong to the same theme though. Only log and build messages when logging is happening.

The Logger by default includes a guard which checks for the
logging level. By removing the custom logging guards, we can decouple
the logging guard from the logging action to be done.

This also follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
@tgxworld
Copy link
Contributor Author

@senny ok done 😄

senny added a commit that referenced this pull request Jul 18, 2014
Prefer to pass block when logging.
@senny senny merged commit e44cb39 into rails:master Jul 18, 2014
@senny
Copy link
Member

senny commented Jul 18, 2014

thank you.

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.

None yet

3 participants