File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,11 @@ module Bootstrap
56
56
end
57
57
Rails . logger . level = ActiveSupport ::Logger . const_get ( config . log_level . to_s . upcase )
58
58
59
- broadcast_logger = ActiveSupport ::BroadcastLogger . new ( Rails . logger )
60
- broadcast_logger . formatter = Rails . logger . formatter
61
- Rails . logger = broadcast_logger
59
+ unless Rails . logger . is_a? ( ActiveSupport ::BroadcastLogger )
60
+ broadcast_logger = ActiveSupport ::BroadcastLogger . new ( Rails . logger )
61
+ broadcast_logger . formatter = Rails . logger . formatter
62
+ Rails . logger = broadcast_logger
63
+ end
62
64
63
65
unless config . consider_all_requests_local
64
66
Rails . error . logger = Rails . logger
Original file line number Diff line number Diff line change @@ -1893,6 +1893,26 @@ def index
1893
1893
assert_equal Logger ::DEBUG , Rails . logger . level
1894
1894
end
1895
1895
1896
+ test "config.logger when logger is already a Broadcast Logger" do
1897
+ logger = ActiveSupport ::BroadcastLogger . new
1898
+
1899
+ make_basic_app do |application |
1900
+ application . config . logger = logger
1901
+ end
1902
+ assert_same ( logger , Rails . logger )
1903
+ end
1904
+
1905
+ test "config.logger when logger is not a Broadcast Logger" do
1906
+ logger = Logger . new ( STDOUT )
1907
+
1908
+ make_basic_app do |application |
1909
+ application . config . logger = logger
1910
+ end
1911
+
1912
+ assert_instance_of ( ActiveSupport ::BroadcastLogger , Rails . logger )
1913
+ assert_includes ( Rails . logger . broadcasts , logger )
1914
+ end
1915
+
1896
1916
test "respond_to? accepts include_private" do
1897
1917
make_basic_app
1898
1918
You can’t perform that action at this time.
0 commit comments