aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/tagged_logging.rb
Commit message (Collapse)AuthorAgeFilesLines
* Cache tags_text to avoid computing tags each time when loggingAkira Matsuda2019-07-311-5/+10
|
* Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* Merge pull request #27792 from tjoyal/sandbox-tagged-loggingRafael Mendonça França2018-09-111-2/+9
|\ | | | | | | TaggedLogging to return a new logger instance
| * TaggedLogging to return a new logger instanceThierry Joyal2017-02-271-2/+9
| |
* | Reduce extra object creations in TaggedLoggingAkira Matsuda2018-04-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tags_text method creates 3 Ruby objects per each logger call when no custom tags are given (which is the default setting, and so presumably the majority use case). This patch reduces two temporary object creations in this case. require 'allocation_tracer' ObjectSpace::AllocationTracer.setup(%i{type}) tags = ['a'] pp before: ObjectSpace::AllocationTracer.trace { tags.collect { |tag| "[#{tag}] " }.join } pp after: ObjectSpace::AllocationTracer.trace { "[#{tags[0]}] " } {:before=>{[:T_ARRAY]=>[1, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}} {:after=>{[:T_STRING]=>[1, 0, 0, 0, 0, 0]}}
* | [Active Support] require_relative => requireAkira Matsuda2017-10-211-3/+3
| | | | | | | | 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-3/+3
|/
* Format and send logs to logger.fatal from DebugExceptions instead of calling ↵Vipul A M2016-11-121-6/+5
| | | | | | fatal multiple times. Expose tags_text from TaggedLogging to be used for log formatting Fixes #26134
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-4/+4
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Doc fix [ci skip]Sushruth Sivaramakrishnan2015-03-051-1/+1
|
* Merge pull request #9065 from atombender/masterRafael Mendonça França2015-01-021-1/+3
|\ | | | | Fix TaggedLogging to allow loggers to be instantiated multiple times without having to share the stack of tags
| * Fix TaggedLogging to allow loggers to be instantiated multiple times without ↵Alexander Staubo2013-01-241-1/+3
| | | | | | | | having to share the stack of tags. This is accomplished by using a unique key for the thread-local tag list. Fixes #9064.
* | added missing requireDaniel Harrington2013-12-021-0/+1
| | | | | | we’re using .delegate and should require it.
* | Revert "make new rails apps log to STDOUT"Steve Klabnik2013-03-151-8/+0
| | | | | | | | | | | | This reverts commit b7d9d6e2cd5082d269dafbc0316e2107febe1451. Per discussion with @jeremy and @rubys on Campfire.
* | make new rails apps log to STDOUTTerence Lee2013-03-151-0/+8
|/
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-1/+1
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* Allow wrapping a logger that hasn't set a formatter. Default to our ↵Jeremy Kemper2012-09-261-2/+4
| | | | SimpleFormatter. Otherwise we try extending nil with the tagging API.
* Add logger.push_tags and .pop_tags to complement logger.taggedJeremy Kemper2012-09-261-14/+28
|
* update AS docs [ci skip]Francesco Rodriguez2012-09-171-6/+7
|
* Revert "Use join without default separator"José Valim2012-08-231-2/+2
| | | | | | This reverts commit b0ab8dc0b2b0f580ffe5ac9ff57fd13152e18577 because it was removing the contents of the message when we did not have any tag. A test case is also committed.
* Use join without default separatorPiotr Niełacny2012-07-201-2/+2
| | | | Use lstrip method
* Revert "Merge pull request #7084 from LTe/logger_default_separator"Aaron Patterson2012-07-181-1/+1
| | | | | This reverts commit c08f30ff5fcda7e07cd9275a073acb2091e4b3f7, reversing changes made to e243a8a32eb4c8777f07ca4b974bd7e38d9477d3.
* Don't use default separatorPiotr Niełacny2012-07-181-1/+1
| | | | When the default separator is set logger will create incorrect output
* removing unnecessary 'examples' noise from activesupportFrancesco Rodriguez2012-05-131-1/+1
|
* Provide access to logger instance within TaggedLogging blocksFND2012-03-191-1/+1
| | | | | | | | | | this improves encapsulation, simplifying occurrences like the following: Rails.logger.tagged("DEBUG") { Rails.logger.debug(msg) } ... by removing the need to rely on (i.e. repeat) outer variables: Rails.logger.tagged("DEBUG") { |logger| logger.debug(msg) }
* make the tagged formatter extend the existing formatterAaron Patterson2012-03-121-2/+2
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-01-211-5/+5
|\
| * Why do we even need a constant here? A variable is fine.Semyon Perepelitsa2012-01-211-4/+4
| |
| * TaggedLogging wraps an object, not a class.Semyon Perepelitsa2012-01-211-1/+1
| |
| * Do not use the same Logger constant for class (from stdlib) and for instance ↵Semyon Perepelitsa2012-01-211-4/+4
| | | | | | | | (from the example)
* | move tagged logging to a module, stop proxying every method callAaron Patterson2012-01-191-36/+32
|/
* simplify some TaggedLogging methodsSergey Nartimov2012-01-181-2/+2
|
* use thread variable in TaggedLoggingSergey Nartimov2012-01-171-3/+2
| | | | previous solution can cause race conditions under GIL-free ruby implementations
* Remove Array.wrap calls in ActiveSupportRafael Mendonça França2012-01-061-1/+1
|
* A few doc changesVijay Dev2011-12-241-3/+3
|
* Fix AS test suite.José Valim2011-12-101-0/+1
|
* * ActiveSupport::BufferedLogger#silence is deprecated. If you want to squelchAaron Patterson2011-12-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | logs for a certain block, change the log level for that block. * ActiveSupport::BufferedLogger#open_log is deprecated. This method should not have been public in the first place. * ActiveSupport::BufferedLogger's behavior of automatically creating the directory for your log file is deprecated. Please make sure to create the directory for your log file before instantiating. * ActiveSupport::BufferedLogger#auto_flushing is deprecated. Either set the sync level on the underlying file handle like this: f = File.open('foo.log', 'w') f.sync = true ActiveSupport::BufferedLogger.new f Or tune your filesystem. The FS cache is now what controls flushing. * ActiveSupport::BufferedLogger#flush is deprecated. Set sync on your filehandle, or tune your filesystem.
* Fix typo in AS::TaggedLoggingClaudio Poli2011-11-291-1/+1
|
* Checking blank if tag might coming nil or blankArun Agrawal2011-10-211-1/+2
| | | In log it should not show the empty array.
* Ensure TaggegLogging is thread safe.José Valim2011-10-191-13/+22
|
* Programatically define the log level methods and use the Logger constants ↵David Heinemeier Hansson2011-10-191-23/+8
| | | | instead (SyslogLogger didnt define them as I expected)
* Added X-Request-Id tracking and TaggedLogging to easily log that and other ↵David Heinemeier Hansson2011-10-191-0/+68
production concerns