Commit Graph

22 Commits

Author SHA1 Message Date
Rafael Mendonça França
8d1ade40dd
Remove deprecated LoggerSilence constant 2020-10-30 00:25:50 +00:00
Akira Matsuda
e4874343e6 Logger#info, debug, etc. are public methods 2020-10-02 15:52:09 +09:00
Michael Grosser
203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Rafael França
ebf98df9fb
Merge pull request #34055 from Edouard-chin/ec-logger-fix
Fix the LoggerSilence to work as described:
2018-10-03 16:45:53 -04:00
Akira Matsuda
370537de05 ⚠️ assigned but unused variable - logger 2018-10-03 21:38:57 +09:00
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
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
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Matthew Draper
f243e7f0d0 Merge pull request #26874 from tgxworld/fix_broadcast_logger
`Broadcast#silence` breaks custom loggers that do not include `Logg…
2016-11-25 15:57:50 +10:30
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Guo Xiang Tan
308e84e982 Broadcast#silence breaks custom loggers that does not include LoggerSilence. 2016-10-24 18:26:13 +08:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
a731125f12 applies new string literal convention in activesupport/test
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
Kevin McPhillips
99bd118eec Broadcast #silence on logger. Rewrite tests. 2016-06-09 22:10:47 -04: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
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
Aaron Patterson
a0da46ecaf pushed broadcasting down to a module 2012-01-20 14:18:29 -08:00
Aaron Patterson
e7e1890c49 made the broadcast logger quack more like a logger 2012-01-20 11:57:07 -08:00
Aaron Patterson
d42b3d4347 add a broadcasting logger so we can split logs 2012-01-20 11:57:07 -08:00