Skip to content

Commit fc62f03

Browse files
committed
[ci skip]Fix documentation and sample code for ActiveSupport::Logger.logger_outputs_to?
Fixed incorrect documentation for `ActiveSupport::Logger.logger_outputs_to?`. The method expects the first argument to be a Logger object and subsequent variadic arguments to be either IO objects or strings representing file paths. Also corrected the sample code in CHANGELOG.md, which previously only passed a single argument, not reflecting the correct usage. related PR: rails#51125
1 parent c402ec7 commit fc62f03

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

activesupport/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
* Add filename support for `Logger.logger_outputs_to?`
1+
* Add filename support for `ActiveSupport::Logger.logger_outputs_to?`
22

33
```ruby
4-
Logger.logger_outputs_to?('/var/log/rails.log')
4+
logger = Logger.new('/var/log/rails.log')
5+
ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
56
```
67

78
*Christian Schmidt*

activesupport/lib/active_support/logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Logger < ::Logger
1515
# # => true
1616
#
1717
# logger = Logger.new('/var/log/rails.log')
18-
# ActiveSupport::Logger.logger_outputs_to?('var/log/rails.log', STDOUT)
18+
# ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
1919
# # => true
2020
def self.logger_outputs_to?(logger, *sources)
2121
loggers = if logger.is_a?(BroadcastLogger)

0 commit comments

Comments
 (0)