aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/logger.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix the LoggerSilence to work as described:Edouard CHIN2018-10-021-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Following the Rails guide which state that a logger needs to include the `ActiveSupport::LoggerSilence` as well as `ActiveSupport::LoggerThreadSafe` modules isn't enough and won't work. Here is a test cases with 3 tests that all fails https://gist.github.com/Edouard-chin/4a72930c2b1eafbbd72a80c66f102010 The problems are the following: 1) The logger needs to call `after_initialize` in order to setup some instance variables. 2) The silence doesn't actually work because the bare ruby Logger `add` method checks for the instance variable `@logger`. We need to override the `add` (like we used to in the ActiveSupport::Logger class). 3) Calling `debug?` `info?` etc... doesn't work as the bare ruby methods will check for the instance variable. Again we need to override this methods (like we used to in the ActiveSupport::Logger class) The LoggerSilence won't work without LoggerThreadSafe, but the later is not public API, the user shouldn't have to include it so I modified to include it automatically. Same for the `after_initialize` method. I find unuintitive to have to call it directly. I modified to instance the variables when the module get included.
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* `Broadcast#silence` breaks custom loggers that does not include `LoggerSilence`.Guo Xiang Tan2016-10-241-2/+2
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Make sure the yielded variable is the loggerRafael Mendonça França2016-06-101-2/+2
|
* Broadcast #silence on logger. Rewrite tests.Kevin McPhillips2016-06-091-0/+18
|
* Fix logger silencing for broadcasted loggersPiotr Jakubowski2016-02-111-0/+7
| | | | | | | | | | | Fix #23609 Commit 629efb6 introduced thread safety to logger silencing but it didn't take into account the fact that the logger can be extended with broadcasting to other logger. This commit introduces local_level to broadcasting Module which enables broadcasted loggers to be properly silenced.
* Remove unused instance variableschneems2016-01-061-1/+0
|
* [close #22917] Don't output to `STDOUT` twiceschneems2016-01-061-1/+11
| | | | | | | | | | | | | | When `rails console` or `rails server` are used along with a logger set to output to `STDOUT` then the contents will show up twice. This happens because the logger is extended with `ActiveSupportLogger.broadcast` with a destination of STDOUT even if it is already outputting to `STDOUT`. Previously PR #22592 attempted to fix this issue, but it ended up causing NoMethodErrors. A better approach than relying on adding a method and flow control is to inspect the log destination directly. For this `ActiveSupport::Logger.logger_outputs_to?` was introduced ```ruby logger = Logger.new(STDOUT) ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) # => true ``` To accomplish this we must look inside of an instance variable of standard lib's Logger `@logdev`. There is a related Ruby proposal to expose this method in a standard way: https://bugs.ruby-lang.org/issues/11955
* Revert "Add Logger option to disable message broadcasts"schneems2016-01-051-12/+3
| | | | This reverts related commits due to #22917.
* Removed extra "the" in the documentation of `broadcast_message` [ci skip]Prathamesh Sonpatki2015-12-281-1/+1
|
* Merge pull request #22771 from nwjsmith/document-broadcast-messagesEileen M. Uchitelle2015-12-271-1/+9
|\ | | | | Document `Logger#broadcast_messages` option
| * Document `Logger#broadcast_messages` optionNate Smith2015-12-231-1/+9
| |
* | Fixes LoggerSilence#silence threadsafetyCarl P. Corliss2015-12-231-0/+14
|/ | | | | | | - uses instance defined level if no custom local log level defined - Keeps track of local log level per [ thread + object-instance ] - prevents memory leakage by removing local level hash key/value on #silence method exit - avoids the use of Thread local variables
* Add Logger option to disable message broadcastsNate Smith2015-12-161-3/+5
| | | | | | | | | When setting the Rails logger to log to STDOUT, it would broadcast the log twice in development. This adds a setting that will prevent messages from being broadcast to multiple logs, while still allowing calls to `#close`, `#level=`, `#progname=`, and `#formatter=` to be broadcasted. Fixes #14769, #11415
* Remove deprecated cattr_* requiresGenadi Samokovarov2013-12-031-1/+1
|
* Revert "Make sure that ActiveSupport::Logger includes the Logger extensions ↵David Heinemeier Hansson2012-12-211-1/+3
| | | | | | from core_ext/logger" (some confusion over deprecation) This reverts commit d00f568a83a5159ed93618b1081bd17858536d1c.
* Make sure that ActiveSupport::Logger includes the Logger extensions from ↵David Heinemeier Hansson2012-12-211-3/+1
| | | | core_ext/logger
* Add ActiveSupport::Logger#silence that works the same as the old ↵David Heinemeier Hansson2012-12-211-0/+4
| | | | Logger#silence extension
* update AS docs [ci skip]Francesco Rodriguez2012-09-171-1/+1
|
* pushed broadcasting down to a moduleAaron Patterson2012-01-201-46/+34
|
* made the broadcast logger quack more like a loggerAaron Patterson2012-01-201-0/+24
|
* add a broadcasting logger so we can split logsAaron Patterson2012-01-201-0/+23
|
* * BufferedLogger is deprecated. Use ActiveSupport::Logger, or the loggerAaron Patterson2011-12-191-0/+18
from Ruby stdlib.