activesupport-logger 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +175 -2
- data/LICENSE.md +10 -0
- data/README.md +447 -181
- data/lib/active_support/logger.rb +4 -4
- data/lib/activesupport/isolated_execution_state.rb +19 -3
- data/lib/activesupport/logger/version.rb +4 -8
- data/lib/activesupport/logger.rb +7 -2
- data/lib/activesupport/logger_silence.rb +0 -0
- data/lib/activesupport/logger_thread_safe_level.rb +0 -0
- data/lib/activesupport-logger.rb +7 -6
- data/sig/activesupport/logger.rbs +22 -0
- data.tar.gz.sig +0 -0
- metadata +228 -118
- metadata.gz.sig +0 -0
- data/CODE_OF_CONDUCT.md +0 -84
- data/CONTRIBUTING.md +0 -106
- data/LICENSE.txt +0 -22
- data/SECURITY.md +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
require_relative "../activesupport
|
|
1
|
+
# Prevent Active Support from loading its own logger implementation. Loading
|
|
2
|
+
# the implementation through this feature path also keeps Ruby's require
|
|
3
|
+
# tracking consistent when Rails is loaded before or after this gem.
|
|
4
|
+
require_relative "../activesupport/logger"
|
|
@@ -13,7 +13,7 @@ module ActiveSupport
|
|
|
13
13
|
def isolation_level=(level)
|
|
14
14
|
return if level == @isolation_level
|
|
15
15
|
|
|
16
|
-
unless %i
|
|
16
|
+
unless %i[thread fiber].include?(level)
|
|
17
17
|
raise ArgumentError, "isolation_level must be `:thread` or `:fiber`, got: `#{level.inspect}`"
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -60,13 +60,29 @@ module ActiveSupport
|
|
|
60
60
|
# Action Controller streaming spawns a new thread and copy thread locals.
|
|
61
61
|
# We do the same here for backward compatibility, but this is very much a hack
|
|
62
62
|
# and streaming should be rethought.
|
|
63
|
-
context
|
|
63
|
+
set_state(context, state_for(other).dup)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
private
|
|
67
67
|
|
|
68
68
|
def state
|
|
69
|
-
context
|
|
69
|
+
state_for(context) || set_state(context, {})
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def state_for(target)
|
|
73
|
+
if scope == Thread
|
|
74
|
+
target.thread_variable_get(:active_support_execution_state)
|
|
75
|
+
else
|
|
76
|
+
target.active_support_execution_state
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def set_state(target, value)
|
|
81
|
+
if scope == Thread
|
|
82
|
+
target.thread_variable_set(:active_support_execution_state, value)
|
|
83
|
+
else
|
|
84
|
+
target.active_support_execution_state = value
|
|
85
|
+
end
|
|
70
86
|
end
|
|
71
87
|
end
|
|
72
88
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
module Logger
|
|
8
|
-
module Version
|
|
9
|
-
VERSION = "2.0.2"
|
|
10
|
-
end
|
|
3
|
+
module ActiveSupport
|
|
4
|
+
module LoggerVersion
|
|
5
|
+
# Current gem version.
|
|
6
|
+
VERSION = "3.0.0"
|
|
11
7
|
end
|
|
12
8
|
end
|
data/lib/activesupport/logger.rb
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
# Std Lib
|
|
4
4
|
require "logger"
|
|
5
5
|
|
|
6
|
+
# Active Support prerequisites used by the extracted implementation.
|
|
7
|
+
require "active_support/concern"
|
|
8
|
+
require "active_support/core_ext/module/attribute_accessors"
|
|
9
|
+
require_relative "isolated_execution_state"
|
|
10
|
+
|
|
6
11
|
# Extracted from Rails v8.0
|
|
7
12
|
require_relative "logger_silence"
|
|
8
13
|
require_relative "logger_thread_safe_level"
|
|
@@ -50,8 +55,6 @@ module ActiveSupport
|
|
|
50
55
|
end
|
|
51
56
|
end
|
|
52
57
|
|
|
53
|
-
private
|
|
54
|
-
|
|
55
58
|
def self.normalize_sources(sources)
|
|
56
59
|
sources.map do |source|
|
|
57
60
|
source = source.path if source.respond_to?(:path)
|
|
@@ -59,5 +62,7 @@ module ActiveSupport
|
|
|
59
62
|
source
|
|
60
63
|
end
|
|
61
64
|
end
|
|
65
|
+
|
|
66
|
+
private_class_method :normalize_sources
|
|
62
67
|
end
|
|
63
68
|
end
|
|
File without changes
|
|
File without changes
|
data/lib/activesupport-logger.rb
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# Ruby stdlib
|
|
2
2
|
require "logger"
|
|
3
3
|
|
|
4
|
+
# Load this gem's compatibility shim before Active Support can resolve Rails'
|
|
5
|
+
# implementation of active_support/logger. The shim delegates back here and
|
|
6
|
+
# marks the feature as loaded, preventing a later superclass mismatch.
|
|
7
|
+
require "active_support/logger"
|
|
8
|
+
|
|
4
9
|
# External libraries
|
|
5
10
|
require "active_support/version"
|
|
6
11
|
require "version_gem"
|
|
7
12
|
require "backports/3.1.0/array/intersect"
|
|
8
13
|
|
|
9
14
|
# This library
|
|
10
|
-
require_relative "activesupport/logger/version"
|
|
11
15
|
|
|
12
16
|
# Original from whatever version of Rails / ActiveSupport is loaded...
|
|
13
17
|
require "active_support/concern"
|
|
@@ -40,11 +44,8 @@ require_relative "activesupport/logger_silence"
|
|
|
40
44
|
# Compare SHA with latest commit to check for changes:
|
|
41
45
|
# https://github.com/rails/rails/blob/main/activesupport/lib/active_support/logger.rb
|
|
42
46
|
require_relative "activesupport/logger"
|
|
47
|
+
require_relative "activesupport/logger/version"
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
module Activesupport
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
Activesupport::Logger::Version.class_eval do
|
|
49
|
+
ActiveSupport::LoggerVersion.class_eval do
|
|
49
50
|
extend VersionGem::Basic
|
|
50
51
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Activesupport
|
|
2
|
+
module Logger
|
|
3
|
+
VERSION: String
|
|
4
|
+
module Version
|
|
5
|
+
VERSION: String
|
|
6
|
+
end
|
|
7
|
+
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module ActiveSupport
|
|
12
|
+
module Version
|
|
13
|
+
VERSION: String
|
|
14
|
+
end
|
|
15
|
+
VERSION: String
|
|
16
|
+
module Logger
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module LoggerVersion
|
|
20
|
+
VERSION: String
|
|
21
|
+
end
|
|
22
|
+
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|