Feature #11955 » ruby-changes.patch
| ChangeLog | ||
|---|---|---|
|
Tue Jan 5 21:45:12 2016 Richard Schneeman <richard.schneeman@gmail.com>
|
||
|
* lib/logger.rb add method Logger#destination
|
||
|
Tue Jan 5 21:44:37 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||
|
* ChangeLog: fix wrong class name.
|
||
| lib/logger.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
# Returns the <tt>Logger::LogDevice</tt> responsible for logging messages.
|
||
|
attr_reader :logdev
|
||
|
# Program name to include in log messages.
|
||
|
attr_accessor :progname
|
||
| ... | ... | |
|
class LogDevice
|
||
|
include Period
|
||
|
# The destination object that will receive the log message.
|
||
|
attr_reader :dev
|
||
|
attr_reader :filename
|
||
|
include MonitorMixin
|
||
|
#
|
||
|
# :call-seq:
|
||
|
# Logger::Logdev.new(STDOUT)
|
||
|
# Logger::Logdev.new('test.log')
|
||
|
# Logger::Logdev.new('test.log', shift_age: 'weekly')
|
||
|
# Logger::Logdev.new('test.log', shift_age: 7, shift_size: 1048576)
|
||
|
#
|
||
|
# === Args
|
||
|
#
|
||
|
# +log+::
|
||
|
# The log destination. This is a filename (String) or IO object (typically
|
||
|
# +STDOUT+, +STDERR+, or an open file).
|
||
|
# +opt+::
|
||
|
# A hash of options
|
||
|
# - +shift_age+
|
||
|
# Number of old log files to keep, *or* frequency of rotation (+daily+,
|
||
|
# +weekly+ or +monthly+).
|
||
|
# - +shift_size+::
|
||
|
# Maximum logfile size (only applies when +shift_age+ is a number).
|
||
|
#
|
||
|
# === Description
|
||
|
#
|
||
|
# Create an instance.
|
||
|
#
|
||
|
def initialize(log = nil, opt = {})
|
||
|
@dev = @filename = @shift_age = @shift_size = nil
|
||
|
mon_initialize
|
||
| test/logger/test_logger.rb | ||
|---|---|---|
|
r.close
|
||
|
assert_equal("msg2\n\n", msg)
|
||
|
end
|
||
|
def test_logdev_and_destination
|
||
|
r, w = IO.pipe
|
||
|
logger = Logger.new(w)
|
||
|
assert_equal(w, logger.logdev.dev)
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »