[ruby/logger] Honor Logger#level overrides

7365c995bf
This commit is contained in:
George Claghorn 2019-09-06 18:28:05 -04:00 committed by Hiroshi SHIBATA
parent af11efd377
commit eb18cb3e47
2 changed files with 21 additions and 6 deletions

View file

@ -363,4 +363,19 @@ class TestLogger < Test::Unit::TestCase
r.close
assert_equal("msg2\n\n", msg)
end
class CustomLogger < Logger
def level
INFO
end
end
def test_overriding_level
logger = CustomLogger.new(nil)
log = log(logger, :info) { "msg" }
assert_equal "msg\n", log.msg
#
log = log(logger, :debug) { "msg" }
assert_nil log.msg
end
end