1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

16 commits

Author SHA1 Message Date
Edouard CHIN
05ad44eb89 Fix the LoggerSilence to work as described:
- 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.
2018-10-02 17:17:23 -04:00
Edouard CHIN
783f86822b Deprecate the LoggerSilence constant:
- I found this weird that the LoggerSilence wasn't using the
  `ActiveSupport` namespace (AFAIK all other classes have it).

  This PR deprecate the use of `LoggerSilence` for
  `ActiveSupport::LoggerSilence` instead.
2018-10-02 12:59:04 -04:00
Edouard CHIN
874cff399c LoggerSilence doesn't require concurrent:
- LoggerThreadSafeLevel does nowaday since 2518bda97c
2018-09-28 02:09:57 -04:00
Akira Matsuda
589dd0f6c9 [Active Support] require_relative => require
This basically reverts 8da30ad6be
2017-10-21 22:48:27 +09:00
Koichi ITO
ac717d65a3 [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
Kir Shatrov
72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Akira Matsuda
8da30ad6be [Active Support] require => require_relative 2017-07-01 18:38:04 +09:00
Genadi Samokovarov
b6b0c99ff3 Use mattr_accessor default: option throughout the project 2017-06-03 13:52:48 +03:00
Xavier Noria
d66e7835be applies new string literal convention in activesupport/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Piotr Jakubowski
2518bda97c Fix logger silencing for broadcasted loggers
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.
2016-02-11 21:00:51 +01:00
schneems
9dcb1b9b07 Revert "Add Logger option to disable message broadcasts"
This reverts related commits due to #22917.
2016-01-05 16:24:35 -06:00
Carl P. Corliss
629efb6057 Fixes LoggerSilence#silence threadsafety
- 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
2015-12-23 12:57:33 -05:00
Nate Smith
e12ffb76ff Add Logger option to disable message broadcasts
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
2015-12-16 16:08:56 -05:00
David Heinemeier Hansson
95f5f8167f Revert "Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger" (some confusion over deprecation)
This reverts commit d00f568a83.
2012-12-21 19:35:10 +01:00
David Heinemeier Hansson
d00f568a83 Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger 2012-12-21 19:28:24 +01:00
David Heinemeier Hansson
f914454f3a Add ActiveSupport::Logger#silence that works the same as the old Logger#silence extension 2012-12-21 19:15:36 +01:00