aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/tagged_logging_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/tagged_logging_test.rb')
-rw-r--r--activesupport/test/tagged_logging_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/test/tagged_logging_test.rb b/activesupport/test/tagged_logging_test.rb
index 17c4214dfc..0751c2469e 100644
--- a/activesupport/test/tagged_logging_test.rb
+++ b/activesupport/test/tagged_logging_test.rb
@@ -1,9 +1,9 @@
require 'abstract_unit'
-require 'active_support/core_ext/logger'
+require 'active_support/logger'
require 'active_support/tagged_logging'
class TaggedLoggingTest < ActiveSupport::TestCase
- class MyLogger < ::Logger
+ class MyLogger < ::ActiveSupport::Logger
def flush(*)
info "[FLUSHED]"
end
@@ -18,7 +18,7 @@ class TaggedLoggingTest < ActiveSupport::TestCase
@logger.tagged("BCX") { @logger.info "Funky time" }
assert_equal "[BCX] Funky time\n", @output.string
end
-
+
test "tagged twice" do
@logger.tagged("BCX") { @logger.tagged("Jason") { @logger.info "Funky time" } }
assert_equal "[BCX] [Jason] Funky time\n", @output.string
@@ -29,6 +29,11 @@ class TaggedLoggingTest < ActiveSupport::TestCase
assert_equal "[BCX] [Jason] [New] Funky time\n", @output.string
end
+ test "provides access to the logger instance" do
+ @logger.tagged("BCX") { |logger| logger.info "Funky time" }
+ assert_equal "[BCX] Funky time\n", @output.string
+ end
+
test "tagged once with blank and nil" do
@logger.tagged(nil, "", "New") { @logger.info "Funky time" }
assert_equal "[New] Funky time\n", @output.string