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

Let File::NULL ("/dev/null", "NUL" etc.) be considered a nil log device #47

Merged
merged 2 commits into from
Mar 29, 2020

Conversation

methodmissing
Copy link
Contributor

References erroneous upstream PR ruby/ruby#2989

I noticed on a Logger instance with File::NULL or /dev/null as log device arguments a lot of formatting and other overhead still occurs, with the expected result essentially still being "I want to blackhole these logs":

GC: 130 (7.40%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       348  (19.8%)         348  (19.8%)     Logger::Formatter#format_datetime
       614  (35.0%)         169   (9.6%)     Logger::Formatter#call
       395  (22.5%)         152   (8.7%)     Logger::LogDevice#write

The logger was configured as Logger.new(File::NULL).

Copy link
Member

@sonots sonots left a comment

Choose a reason for hiding this comment

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

lgtm

@sonots
Copy link
Member

sonots commented Mar 28, 2020

hmm, ci failed. could you check?

@methodmissing
Copy link
Contributor Author

Yep, already did https://travis-ci.com/github/ruby/logger/jobs/306798582 , a lot of tests are failing around this warning being spewed to stderr:

 1. [2/2] Assertion for "stderr"
     | <[]> expected but was
     | <["/Users/travis/build/ruby/logger/lib/logger/version.rb:4: warning: already initialized constant Logger::VERSION",
     |  "/Users/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/logger.rb:227: warning: previous definition of VERSION was here"]>.
     | 

@methodmissing
Copy link
Contributor Author

methodmissing commented Mar 28, 2020

I think it references https://github.com/ruby/logger/pull/44/files - Logger::VERSION referenced from this core extraction, but the constant is loaded from the host ruby environment already (2.6.3 in this case)

🐔 and 🥚 problem

@sonots
Copy link
Member

sonots commented Mar 29, 2020

thanks, looks not related with this PR. I am going to merge this

@sonots sonots merged commit 110d9d1 into ruby:master Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants