diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/buffered_logger.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb index c646b43d96..6025e1a6d0 100644 --- a/activesupport/lib/active_support/buffered_logger.rb +++ b/activesupport/lib/active_support/buffered_logger.rb @@ -52,7 +52,9 @@ module ActiveSupport def add(severity, message = nil, progname = nil, &block) return if @level > severity message = message || (block && block.call) || progname - message << "\n" unless message[-1] == ?\n + # If a newline is nessesary then create a new message end with a new line. + # Ensures that the original message is not mutated. + message = "#{message}\n" unless message[-1] == ?\n @buffer << message flush if auto_flushing message |