diff --git a/ChangeLog b/ChangeLog index b9a6606..40b91fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jan 5 21:45:12 2016 Richard Schneeman + + * lib/logger.rb add method Logger#destination + Tue Jan 5 21:44:37 2016 SHIBATA Hiroshi * ChangeLog: fix wrong class name. diff --git a/lib/logger.rb b/lib/logger.rb index 2246673..8a041c6 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -271,6 +271,11 @@ def level=(severity) end end + # The object that will receive log messages. + def destination + @logdev.dev + end + # Program name to include in log messages. attr_accessor :progname diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb index 836d3b3..d16b539 100644 --- a/test/logger/test_logger.rb +++ b/test/logger/test_logger.rb @@ -292,4 +292,10 @@ def test_lshift r.close assert_equal("msg2\n\n", msg) end + + def test_log_object + r, w = IO.pipe + logger = Logger.new(w) + assert_equal(w, logger.destination) + end end