[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
Issue #12134 has been updated by Martin D端rst.
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74718] [Ruby trunk Feature#12224] logger: Allow specifying log level in constructor
From:
shevegen@...
Date:
2016-03-29 19:03:14 UTC
List:
ruby-core #74718
Issue #12224 has been updated by Robert A. Heiler.
Here is the link to Logger:
http://ruby-doc.org/stdlib-2.3.0/libdoc/logger/rdoc/Logger.html#method-c-new
It already uses multiple arguments:
new(logdev, shift_age = 7, shift_size = 1048576)
new(logdev, shift_age = 'weekly')
So I assume another optional one such as :level would be ok (my personal opinion).
----------------------------------------
Feature #12224: logger: Allow specifying log level in constructor
https://bugs.ruby-lang.org/issues/12224#change-57852
* Author: Kazuki Yamaguchi
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
When I use Logger class, I very often (or maybe always) set minimal log level together. Since method chaining can't be used for setters, we have to split it into two statements:
~~~ruby
logger = Logger.new($stdout)
logger.level = :info
~~~
Imagine if the `logger` was much longer name, such as ActiveRecord::Base.logger. I personally don't want to repeat it.
I found a number of samples on GitHub (they would countain copy-and-pastes though) [1].
So I propose adding a new keyword argument `level` to Logger.new:
~~~ruby
logger = Logger.new($stdout, level: :info)
~~~
This will be effectively same as the original code I indicated above.
I attached a patch for this.
[1] https://github.com/search?utf8=%E2%9C%93&q=%22%3D+Logger.new%22+%22level+%3D%22+language%3ARuby&type=Code&ref=searchresults
---Files--------------------------------
0001-lib-logger.rb-allow-specifying-log-level-via-Logger..patch (2.25 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>