logstruct 0.1.0 → 0.1.2
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
- data/CHANGELOG.md +11 -1
- data/README.md +23 -3
- data/lib/log_struct/boot_buffer.rb +28 -0
- data/lib/log_struct/builders/active_job.rb +84 -0
- data/lib/log_struct/concerns/configuration.rb +178 -15
- data/lib/log_struct/concerns/error_handling.rb +3 -7
- data/lib/log_struct/config_struct/filters.rb +18 -0
- data/lib/log_struct/config_struct/integrations.rb +8 -12
- data/lib/log_struct/configuration.rb +13 -0
- data/lib/log_struct/enums/event.rb +13 -0
- data/lib/log_struct/enums/log_field.rb +154 -0
- data/lib/log_struct/enums/source.rb +4 -1
- data/lib/log_struct/formatter.rb +29 -17
- data/lib/log_struct/integrations/action_mailer/error_handling.rb +3 -11
- data/lib/log_struct/integrations/action_mailer/event_logging.rb +22 -12
- data/lib/log_struct/integrations/active_job/log_subscriber.rb +52 -48
- data/lib/log_struct/integrations/active_model_serializers.rb +8 -14
- data/lib/log_struct/integrations/active_record.rb +35 -5
- data/lib/log_struct/integrations/active_storage.rb +59 -20
- data/lib/log_struct/integrations/ahoy.rb +2 -1
- data/lib/log_struct/integrations/carrierwave.rb +13 -16
- data/lib/log_struct/integrations/dotenv.rb +278 -0
- data/lib/log_struct/integrations/good_job/log_subscriber.rb +86 -136
- data/lib/log_struct/integrations/good_job/logger.rb +8 -10
- data/lib/log_struct/integrations/good_job.rb +5 -7
- data/lib/log_struct/integrations/host_authorization.rb +25 -4
- data/lib/log_struct/integrations/lograge.rb +20 -14
- data/lib/log_struct/integrations/puma.rb +477 -0
- data/lib/log_struct/integrations/rack_error_handler/middleware.rb +11 -18
- data/lib/log_struct/integrations/shrine.rb +44 -19
- data/lib/log_struct/integrations/sorbet.rb +48 -0
- data/lib/log_struct/integrations.rb +21 -0
- data/lib/log_struct/log/action_mailer/delivered.rb +99 -0
- data/lib/log_struct/log/action_mailer/delivery.rb +99 -0
- data/lib/log_struct/log/action_mailer.rb +30 -45
- data/lib/log_struct/log/active_job/enqueue.rb +125 -0
- data/lib/log_struct/log/active_job/finish.rb +130 -0
- data/lib/log_struct/log/active_job/schedule.rb +125 -0
- data/lib/log_struct/log/active_job/start.rb +130 -0
- data/lib/log_struct/log/active_job.rb +41 -54
- data/lib/log_struct/log/active_model_serializers.rb +72 -33
- data/lib/log_struct/log/active_storage/delete.rb +87 -0
- data/lib/log_struct/log/active_storage/download.rb +103 -0
- data/lib/log_struct/log/active_storage/exist.rb +93 -0
- data/lib/log_struct/log/active_storage/metadata.rb +93 -0
- data/lib/log_struct/log/active_storage/stream.rb +93 -0
- data/lib/log_struct/log/active_storage/upload.rb +118 -0
- data/lib/log_struct/log/active_storage/url.rb +93 -0
- data/lib/log_struct/log/active_storage.rb +32 -68
- data/lib/log_struct/log/ahoy.rb +67 -33
- data/lib/log_struct/log/carrierwave/delete.rb +115 -0
- data/lib/log_struct/log/carrierwave/download.rb +131 -0
- data/lib/log_struct/log/carrierwave/upload.rb +141 -0
- data/lib/log_struct/log/carrierwave.rb +37 -72
- data/lib/log_struct/log/dotenv/load.rb +76 -0
- data/lib/log_struct/log/dotenv/restore.rb +76 -0
- data/lib/log_struct/log/dotenv/save.rb +76 -0
- data/lib/log_struct/log/dotenv/update.rb +76 -0
- data/lib/log_struct/log/dotenv.rb +12 -0
- data/lib/log_struct/log/error.rb +58 -47
- data/lib/log_struct/log/good_job/enqueue.rb +126 -0
- data/lib/log_struct/log/good_job/error.rb +151 -0
- data/lib/log_struct/log/good_job/finish.rb +136 -0
- data/lib/log_struct/log/good_job/log.rb +131 -0
- data/lib/log_struct/log/good_job/schedule.rb +136 -0
- data/lib/log_struct/log/good_job/start.rb +136 -0
- data/lib/log_struct/log/good_job.rb +40 -141
- data/lib/log_struct/log/interfaces/additional_data_field.rb +1 -17
- data/lib/log_struct/log/interfaces/common_fields.rb +1 -39
- data/lib/log_struct/log/interfaces/public_common_fields.rb +1 -28
- data/lib/log_struct/log/interfaces/request_fields.rb +1 -33
- data/lib/log_struct/log/plain.rb +59 -34
- data/lib/log_struct/log/puma/shutdown.rb +80 -0
- data/lib/log_struct/log/puma/start.rb +120 -0
- data/lib/log_struct/log/puma.rb +10 -0
- data/lib/log_struct/log/request.rb +132 -48
- data/lib/log_struct/log/security/blocked_host.rb +141 -0
- data/lib/log_struct/log/security/csrf_violation.rb +131 -0
- data/lib/log_struct/log/security/ip_spoof.rb +141 -0
- data/lib/log_struct/log/security.rb +40 -70
- data/lib/log_struct/log/shared/add_request_fields.rb +1 -26
- data/lib/log_struct/log/shared/merge_additional_data_fields.rb +1 -22
- data/lib/log_struct/log/shared/serialize_common.rb +1 -33
- data/lib/log_struct/log/shared/serialize_common_public.rb +9 -9
- data/lib/log_struct/log/shrine/delete.rb +85 -0
- data/lib/log_struct/log/shrine/download.rb +90 -0
- data/lib/log_struct/log/shrine/exist.rb +90 -0
- data/lib/log_struct/log/shrine/metadata.rb +90 -0
- data/lib/log_struct/log/shrine/upload.rb +105 -0
- data/lib/log_struct/log/shrine.rb +10 -67
- data/lib/log_struct/log/sidekiq.rb +65 -26
- data/lib/log_struct/log/sql.rb +113 -106
- data/lib/log_struct/log.rb +29 -36
- data/lib/log_struct/multi_error_reporter.rb +80 -22
- data/lib/log_struct/param_filters.rb +50 -7
- data/lib/log_struct/rails_boot_banner_silencer.rb +116 -0
- data/lib/log_struct/railtie.rb +67 -0
- data/lib/log_struct/semantic_logger/formatter.rb +4 -2
- data/lib/log_struct/semantic_logger/setup.rb +34 -18
- data/lib/log_struct/shared/interfaces/additional_data_field.rb +22 -0
- data/lib/log_struct/shared/interfaces/common_fields.rb +39 -0
- data/lib/log_struct/shared/interfaces/public_common_fields.rb +29 -0
- data/lib/log_struct/shared/interfaces/request_fields.rb +39 -0
- data/lib/log_struct/shared/shared/add_request_fields.rb +28 -0
- data/lib/log_struct/shared/shared/merge_additional_data_fields.rb +27 -0
- data/lib/log_struct/shared/shared/serialize_common.rb +58 -0
- data/lib/log_struct/version.rb +1 -1
- data/lib/log_struct.rb +36 -4
- data/logstruct.gemspec +2 -1
- metadata +78 -9
- data/lib/log_struct/log/interfaces/message_field.rb +0 -20
- data/lib/log_struct/log_keys.rb +0 -102
@@ -0,0 +1,28 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../../enums/log_field"
|
5
|
+
require_relative "../interfaces/request_fields"
|
6
|
+
|
7
|
+
module LogStruct
|
8
|
+
module Log
|
9
|
+
module Shared
|
10
|
+
module AddRequestFields
|
11
|
+
extend T::Sig
|
12
|
+
extend T::Helpers
|
13
|
+
|
14
|
+
requires_ancestor { Interfaces::RequestFields }
|
15
|
+
|
16
|
+
sig { params(hash: T::Hash[Symbol, T.untyped]).void }
|
17
|
+
def add_request_fields(hash)
|
18
|
+
hash[LogField::Path.serialize] = path if path
|
19
|
+
hash[LogField::HttpMethod.serialize] = http_method if http_method
|
20
|
+
hash[LogField::SourceIp.serialize] = source_ip if source_ip
|
21
|
+
hash[LogField::UserAgent.serialize] = user_agent if user_agent
|
22
|
+
hash[LogField::Referer.serialize] = referer if referer
|
23
|
+
hash[LogField::RequestId.serialize] = request_id if request_id
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../interfaces/additional_data_field"
|
5
|
+
|
6
|
+
module LogStruct
|
7
|
+
module Log
|
8
|
+
module Shared
|
9
|
+
module MergeAdditionalDataFields
|
10
|
+
extend T::Sig
|
11
|
+
extend T::Helpers
|
12
|
+
|
13
|
+
requires_ancestor { T::Struct }
|
14
|
+
requires_ancestor { Interfaces::AdditionalDataField }
|
15
|
+
|
16
|
+
sig { params(hash: T::Hash[Symbol, T.untyped]).void }
|
17
|
+
def merge_additional_data_fields(hash)
|
18
|
+
ad = additional_data
|
19
|
+
return unless ad
|
20
|
+
ad.each do |key, value|
|
21
|
+
hash[key.to_sym] = value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../../enums/log_field"
|
5
|
+
require_relative "../interfaces/common_fields"
|
6
|
+
require_relative "../../log/shared/merge_additional_data_fields"
|
7
|
+
|
8
|
+
module LogStruct
|
9
|
+
module Log
|
10
|
+
module Shared
|
11
|
+
module SerializeCommon
|
12
|
+
extend T::Sig
|
13
|
+
extend T::Helpers
|
14
|
+
|
15
|
+
requires_ancestor { Interfaces::CommonFields }
|
16
|
+
|
17
|
+
sig { params(strict: T::Boolean).returns(T::Hash[Symbol, T.untyped]) }
|
18
|
+
def serialize(strict = true)
|
19
|
+
# Start with shared fields (source, event, level, timestamp)
|
20
|
+
out = serialize_common(strict)
|
21
|
+
|
22
|
+
# Merge event/base fields from the struct-specific hash
|
23
|
+
kernel_self = T.cast(self, Kernel)
|
24
|
+
field_hash = T.cast(kernel_self.public_send(:to_h), T::Hash[LogStruct::LogField, T.untyped])
|
25
|
+
field_hash.each do |log_field, value|
|
26
|
+
next if value.nil?
|
27
|
+
key = log_field.serialize
|
28
|
+
out[key] = value.is_a?(::Time) ? value.iso8601 : value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Merge any additional_data at top level if available
|
32
|
+
if kernel_self.respond_to?(:merge_additional_data_fields)
|
33
|
+
# merge_additional_data_fields expects symbol keys
|
34
|
+
merge_target = T.cast(self, LogStruct::Log::Shared::MergeAdditionalDataFields)
|
35
|
+
merge_target.merge_additional_data_fields(out)
|
36
|
+
end
|
37
|
+
|
38
|
+
out
|
39
|
+
end
|
40
|
+
|
41
|
+
sig { params(strict: T::Boolean).returns(T::Hash[Symbol, T.untyped]) }
|
42
|
+
def serialize_common(strict = true)
|
43
|
+
{
|
44
|
+
LogField::Source.serialize => source.serialize.to_s,
|
45
|
+
LogField::Event.serialize => event.serialize.to_s,
|
46
|
+
LogField::Level.serialize => level.serialize.to_s,
|
47
|
+
LogField::Timestamp.serialize => timestamp.iso8601(3)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
sig { params(options: T.untyped).returns(T::Hash[String, T.untyped]) }
|
52
|
+
def as_json(options = nil)
|
53
|
+
serialize.transform_keys(&:to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/log_struct/version.rb
CHANGED
data/lib/log_struct.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Core library files
|
5
5
|
require "log_struct/sorbet"
|
6
6
|
require "log_struct/version"
|
7
|
-
require "log_struct/enums"
|
7
|
+
require "log_struct/enums"
|
8
8
|
require "log_struct/configuration"
|
9
9
|
require "log_struct/formatter"
|
10
10
|
require "log_struct/railtie"
|
@@ -12,9 +12,6 @@ require "log_struct/concerns/error_handling"
|
|
12
12
|
require "log_struct/concerns/configuration"
|
13
13
|
require "log_struct/concerns/logging"
|
14
14
|
|
15
|
-
# Monkey-patch ActiveSupport::TaggedLogging::Formatter to support hash input/output
|
16
|
-
require "log_struct/monkey_patches/active_support/tagged_logging/formatter"
|
17
|
-
|
18
15
|
# Require integrations
|
19
16
|
require "log_struct/integrations"
|
20
17
|
|
@@ -23,15 +20,50 @@ require "log_struct/semantic_logger/formatter"
|
|
23
20
|
require "log_struct/semantic_logger/color_formatter"
|
24
21
|
require "log_struct/semantic_logger/logger"
|
25
22
|
require "log_struct/semantic_logger/setup"
|
23
|
+
require "log_struct/rails_boot_banner_silencer"
|
26
24
|
|
27
25
|
module LogStruct
|
26
|
+
extend T::Sig
|
27
|
+
|
28
|
+
@server_mode = T.let(false, T::Boolean)
|
29
|
+
|
28
30
|
class Error < StandardError; end
|
29
31
|
|
30
32
|
extend Concerns::ErrorHandling::ClassMethods
|
31
33
|
extend Concerns::Configuration::ClassMethods
|
32
34
|
extend Concerns::Logging::ClassMethods
|
33
35
|
|
36
|
+
sig { returns(T::Boolean) }
|
37
|
+
def self.server_mode?
|
38
|
+
@server_mode
|
39
|
+
end
|
40
|
+
|
41
|
+
sig { params(value: T::Boolean).void }
|
42
|
+
def self.server_mode=(value)
|
43
|
+
@server_mode = value
|
44
|
+
end
|
45
|
+
|
34
46
|
# Set enabled at require time based on current Rails environment.
|
35
47
|
# (Users can disable or enable LogStruct later in an initializer.)
|
36
48
|
set_enabled_from_rails_env!
|
49
|
+
|
50
|
+
# Silence Rails boot banners for cleaner server output
|
51
|
+
LogStruct::RailsBootBannerSilencer.install!
|
52
|
+
|
53
|
+
# Patch Puma immediately for server runs so we can convert its lifecycle
|
54
|
+
# messages into structured logs reliably.
|
55
|
+
if ARGV.include?("server")
|
56
|
+
begin
|
57
|
+
require "log_struct/integrations/puma"
|
58
|
+
LogStruct::Integrations::Puma.install_patches!
|
59
|
+
|
60
|
+
# Patches installed now; Rack handler patch covers server boot path
|
61
|
+
rescue => e
|
62
|
+
if defined?(::Rails) && ::Rails.respond_to?(:env) && ::Rails.env.test?
|
63
|
+
raise e
|
64
|
+
else
|
65
|
+
LogStruct.handle_exception(e, source: LogStruct::Source::Puma)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
37
69
|
end
|
data/logstruct.gemspec
CHANGED
@@ -47,8 +47,9 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency "shrine", "~> 3.5"
|
48
48
|
spec.add_development_dependency "sidekiq", "~> 7.2"
|
49
49
|
spec.add_development_dependency "sorbet", "~> 0.5"
|
50
|
-
spec.add_development_dependency "ahoy_matey", "
|
50
|
+
spec.add_development_dependency "ahoy_matey", ">= 4.1", "< 6.0"
|
51
51
|
spec.add_development_dependency "active_model_serializers", "~> 0.10.13"
|
52
|
+
spec.add_development_dependency "dotenv-rails", "~> 3.1"
|
52
53
|
|
53
54
|
spec.metadata["rubygems_mfa_required"] = "true"
|
54
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DocSpring
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: lograge
|
@@ -181,16 +181,22 @@ dependencies:
|
|
181
181
|
name: ahoy_matey
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
|
-
- - "
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '4.1'
|
187
|
+
- - "<"
|
185
188
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
189
|
+
version: '6.0'
|
187
190
|
type: :development
|
188
191
|
prerelease: false
|
189
192
|
version_requirements: !ruby/object:Gem::Requirement
|
190
193
|
requirements:
|
191
|
-
- - "
|
194
|
+
- - ">="
|
192
195
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
196
|
+
version: '4.1'
|
197
|
+
- - "<"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '6.0'
|
194
200
|
- !ruby/object:Gem::Dependency
|
195
201
|
name: active_model_serializers
|
196
202
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +211,20 @@ dependencies:
|
|
205
211
|
- - "~>"
|
206
212
|
- !ruby/object:Gem::Version
|
207
213
|
version: 0.10.13
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: dotenv-rails
|
216
|
+
requirement: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - "~>"
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '3.1'
|
221
|
+
type: :development
|
222
|
+
prerelease: false
|
223
|
+
version_requirements: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - "~>"
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '3.1'
|
208
228
|
description: An opinionated and type-safe structured logging solution. Configures
|
209
229
|
any Rails app to log JSON to stdout. Structured logging is automatically configured
|
210
230
|
for many gems, including Sidekiq, Carrierwave, Shrine, etc. Log messages, params,
|
@@ -219,6 +239,8 @@ files:
|
|
219
239
|
- LICENSE
|
220
240
|
- README.md
|
221
241
|
- lib/log_struct.rb
|
242
|
+
- lib/log_struct/boot_buffer.rb
|
243
|
+
- lib/log_struct/builders/active_job.rb
|
222
244
|
- lib/log_struct/concerns/configuration.rb
|
223
245
|
- lib/log_struct/concerns/error_handling.rb
|
224
246
|
- lib/log_struct/concerns/logging.rb
|
@@ -231,6 +253,7 @@ files:
|
|
231
253
|
- lib/log_struct/enums/error_reporter.rb
|
232
254
|
- lib/log_struct/enums/event.rb
|
233
255
|
- lib/log_struct/enums/level.rb
|
256
|
+
- lib/log_struct/enums/log_field.rb
|
234
257
|
- lib/log_struct/enums/source.rb
|
235
258
|
- lib/log_struct/formatter.rb
|
236
259
|
- lib/log_struct/handlers.rb
|
@@ -248,12 +271,14 @@ files:
|
|
248
271
|
- lib/log_struct/integrations/active_storage.rb
|
249
272
|
- lib/log_struct/integrations/ahoy.rb
|
250
273
|
- lib/log_struct/integrations/carrierwave.rb
|
274
|
+
- lib/log_struct/integrations/dotenv.rb
|
251
275
|
- lib/log_struct/integrations/good_job.rb
|
252
276
|
- lib/log_struct/integrations/good_job/log_subscriber.rb
|
253
277
|
- lib/log_struct/integrations/good_job/logger.rb
|
254
278
|
- lib/log_struct/integrations/host_authorization.rb
|
255
279
|
- lib/log_struct/integrations/integration_interface.rb
|
256
280
|
- lib/log_struct/integrations/lograge.rb
|
281
|
+
- lib/log_struct/integrations/puma.rb
|
257
282
|
- lib/log_struct/integrations/rack.rb
|
258
283
|
- lib/log_struct/integrations/rack_error_handler.rb
|
259
284
|
- lib/log_struct/integrations/rack_error_handler/middleware.rb
|
@@ -263,37 +288,81 @@ files:
|
|
263
288
|
- lib/log_struct/integrations/sorbet.rb
|
264
289
|
- lib/log_struct/log.rb
|
265
290
|
- lib/log_struct/log/action_mailer.rb
|
291
|
+
- lib/log_struct/log/action_mailer/delivered.rb
|
292
|
+
- lib/log_struct/log/action_mailer/delivery.rb
|
266
293
|
- lib/log_struct/log/active_job.rb
|
294
|
+
- lib/log_struct/log/active_job/enqueue.rb
|
295
|
+
- lib/log_struct/log/active_job/finish.rb
|
296
|
+
- lib/log_struct/log/active_job/schedule.rb
|
297
|
+
- lib/log_struct/log/active_job/start.rb
|
267
298
|
- lib/log_struct/log/active_model_serializers.rb
|
268
299
|
- lib/log_struct/log/active_storage.rb
|
300
|
+
- lib/log_struct/log/active_storage/delete.rb
|
301
|
+
- lib/log_struct/log/active_storage/download.rb
|
302
|
+
- lib/log_struct/log/active_storage/exist.rb
|
303
|
+
- lib/log_struct/log/active_storage/metadata.rb
|
304
|
+
- lib/log_struct/log/active_storage/stream.rb
|
305
|
+
- lib/log_struct/log/active_storage/upload.rb
|
306
|
+
- lib/log_struct/log/active_storage/url.rb
|
269
307
|
- lib/log_struct/log/ahoy.rb
|
270
308
|
- lib/log_struct/log/carrierwave.rb
|
309
|
+
- lib/log_struct/log/carrierwave/delete.rb
|
310
|
+
- lib/log_struct/log/carrierwave/download.rb
|
311
|
+
- lib/log_struct/log/carrierwave/upload.rb
|
312
|
+
- lib/log_struct/log/dotenv.rb
|
313
|
+
- lib/log_struct/log/dotenv/load.rb
|
314
|
+
- lib/log_struct/log/dotenv/restore.rb
|
315
|
+
- lib/log_struct/log/dotenv/save.rb
|
316
|
+
- lib/log_struct/log/dotenv/update.rb
|
271
317
|
- lib/log_struct/log/error.rb
|
272
318
|
- lib/log_struct/log/good_job.rb
|
319
|
+
- lib/log_struct/log/good_job/enqueue.rb
|
320
|
+
- lib/log_struct/log/good_job/error.rb
|
321
|
+
- lib/log_struct/log/good_job/finish.rb
|
322
|
+
- lib/log_struct/log/good_job/log.rb
|
323
|
+
- lib/log_struct/log/good_job/schedule.rb
|
324
|
+
- lib/log_struct/log/good_job/start.rb
|
273
325
|
- lib/log_struct/log/interfaces/additional_data_field.rb
|
274
326
|
- lib/log_struct/log/interfaces/common_fields.rb
|
275
|
-
- lib/log_struct/log/interfaces/message_field.rb
|
276
327
|
- lib/log_struct/log/interfaces/public_common_fields.rb
|
277
328
|
- lib/log_struct/log/interfaces/request_fields.rb
|
278
329
|
- lib/log_struct/log/plain.rb
|
330
|
+
- lib/log_struct/log/puma.rb
|
331
|
+
- lib/log_struct/log/puma/shutdown.rb
|
332
|
+
- lib/log_struct/log/puma/start.rb
|
279
333
|
- lib/log_struct/log/request.rb
|
280
334
|
- lib/log_struct/log/security.rb
|
335
|
+
- lib/log_struct/log/security/blocked_host.rb
|
336
|
+
- lib/log_struct/log/security/csrf_violation.rb
|
337
|
+
- lib/log_struct/log/security/ip_spoof.rb
|
281
338
|
- lib/log_struct/log/shared/add_request_fields.rb
|
282
339
|
- lib/log_struct/log/shared/merge_additional_data_fields.rb
|
283
340
|
- lib/log_struct/log/shared/serialize_common.rb
|
284
341
|
- lib/log_struct/log/shared/serialize_common_public.rb
|
285
342
|
- lib/log_struct/log/shrine.rb
|
343
|
+
- lib/log_struct/log/shrine/delete.rb
|
344
|
+
- lib/log_struct/log/shrine/download.rb
|
345
|
+
- lib/log_struct/log/shrine/exist.rb
|
346
|
+
- lib/log_struct/log/shrine/metadata.rb
|
347
|
+
- lib/log_struct/log/shrine/upload.rb
|
286
348
|
- lib/log_struct/log/sidekiq.rb
|
287
349
|
- lib/log_struct/log/sql.rb
|
288
|
-
- lib/log_struct/log_keys.rb
|
289
350
|
- lib/log_struct/monkey_patches/active_support/tagged_logging/formatter.rb
|
290
351
|
- lib/log_struct/multi_error_reporter.rb
|
291
352
|
- lib/log_struct/param_filters.rb
|
353
|
+
- lib/log_struct/rails_boot_banner_silencer.rb
|
292
354
|
- lib/log_struct/railtie.rb
|
293
355
|
- lib/log_struct/semantic_logger/color_formatter.rb
|
294
356
|
- lib/log_struct/semantic_logger/formatter.rb
|
295
357
|
- lib/log_struct/semantic_logger/logger.rb
|
296
358
|
- lib/log_struct/semantic_logger/setup.rb
|
359
|
+
- lib/log_struct/shared/interfaces/additional_data_field.rb
|
360
|
+
- lib/log_struct/shared/interfaces/common_fields.rb
|
361
|
+
- lib/log_struct/shared/interfaces/public_common_fields.rb
|
362
|
+
- lib/log_struct/shared/interfaces/request_fields.rb
|
363
|
+
- lib/log_struct/shared/shared/add_request_fields.rb
|
364
|
+
- lib/log_struct/shared/shared/merge_additional_data_fields.rb
|
365
|
+
- lib/log_struct/shared/shared/serialize_common.rb
|
297
366
|
- lib/log_struct/sorbet.rb
|
298
367
|
- lib/log_struct/sorbet/serialize_symbol_keys.rb
|
299
368
|
- lib/log_struct/string_scrubber.rb
|
@@ -322,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
391
|
- !ruby/object:Gem::Version
|
323
392
|
version: '0'
|
324
393
|
requirements: []
|
325
|
-
rubygems_version: 3.6.
|
394
|
+
rubygems_version: 3.6.9
|
326
395
|
specification_version: 4
|
327
396
|
summary: Type-Safe JSON Structured Logging for Rails Apps
|
328
397
|
test_files: []
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module LogStruct
|
5
|
-
module Log
|
6
|
-
module Interfaces
|
7
|
-
# Common interface for logs that include a message field
|
8
|
-
module MessageField
|
9
|
-
extend T::Sig
|
10
|
-
extend T::Helpers
|
11
|
-
|
12
|
-
interface!
|
13
|
-
|
14
|
-
# Message field
|
15
|
-
sig { abstract.returns(T.nilable(String)) }
|
16
|
-
def message; end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/log_struct/log_keys.rb
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module LogStruct
|
5
|
-
# Define a mapping of property names to JSON keys
|
6
|
-
LOG_KEYS = T.let({
|
7
|
-
# Ruby struct property name => JSON key name
|
8
|
-
|
9
|
-
# Shared fields
|
10
|
-
source: :src,
|
11
|
-
event: :evt,
|
12
|
-
timestamp: :ts,
|
13
|
-
level: :lvl,
|
14
|
-
|
15
|
-
# Common fields
|
16
|
-
message: :msg,
|
17
|
-
data: :data,
|
18
|
-
|
19
|
-
# Request-related fields
|
20
|
-
path: :path,
|
21
|
-
http_method: :method, # Use `http_method` because `method` is a reserved word
|
22
|
-
source_ip: :source_ip,
|
23
|
-
user_agent: :user_agent,
|
24
|
-
referer: :referer,
|
25
|
-
request_id: :request_id,
|
26
|
-
|
27
|
-
# HTTP-specific fields
|
28
|
-
format: :format,
|
29
|
-
controller: :controller,
|
30
|
-
action: :action,
|
31
|
-
status: :status,
|
32
|
-
duration: :duration,
|
33
|
-
view: :view,
|
34
|
-
db: :db,
|
35
|
-
params: :params,
|
36
|
-
|
37
|
-
# Security-specific fields
|
38
|
-
blocked_host: :blocked_host,
|
39
|
-
blocked_hosts: :blocked_hosts,
|
40
|
-
client_ip: :client_ip,
|
41
|
-
x_forwarded_for: :x_forwarded_for,
|
42
|
-
|
43
|
-
# Email-specific fields
|
44
|
-
to: :to,
|
45
|
-
from: :from,
|
46
|
-
subject: :subject,
|
47
|
-
|
48
|
-
# Error fields
|
49
|
-
err_class: :err_class,
|
50
|
-
backtrace: :backtrace,
|
51
|
-
|
52
|
-
# Job-specific fields
|
53
|
-
job_id: :job_id,
|
54
|
-
job_class: :job_class,
|
55
|
-
queue_name: :queue_name,
|
56
|
-
arguments: :arguments,
|
57
|
-
retry_count: :retry_count,
|
58
|
-
|
59
|
-
# Sidekiq-specific fields
|
60
|
-
process_id: :pid,
|
61
|
-
thread_id: :tid,
|
62
|
-
context: :ctx,
|
63
|
-
|
64
|
-
# Storage-specific fields (ActiveStorage)
|
65
|
-
checksum: :checksum,
|
66
|
-
exist: :exist,
|
67
|
-
url: :url,
|
68
|
-
prefix: :prefix,
|
69
|
-
range: :range,
|
70
|
-
|
71
|
-
# Storage-specific fields (Shrine)
|
72
|
-
storage: :storage,
|
73
|
-
operation: :op,
|
74
|
-
file_id: :file_id,
|
75
|
-
filename: :filename,
|
76
|
-
mime_type: :mime_type,
|
77
|
-
size: :size,
|
78
|
-
metadata: :metadata,
|
79
|
-
location: :location,
|
80
|
-
upload_options: :upload_opts,
|
81
|
-
download_options: :download_opts,
|
82
|
-
options: :opts,
|
83
|
-
uploader: :uploader,
|
84
|
-
|
85
|
-
# CarrierWave-specific fields
|
86
|
-
model: :model,
|
87
|
-
mount_point: :mount_point,
|
88
|
-
|
89
|
-
# SQL-specific fields
|
90
|
-
sql: :sql,
|
91
|
-
name: :name,
|
92
|
-
row_count: :row_count,
|
93
|
-
connection_adapter: :connection_adapter,
|
94
|
-
bind_params: :bind_params,
|
95
|
-
database_name: :database_name,
|
96
|
-
connection_pool_size: :connection_pool_size,
|
97
|
-
active_connections: :active_connections,
|
98
|
-
operation_type: :operation_type,
|
99
|
-
table_names: :table_names
|
100
|
-
}.freeze,
|
101
|
-
T::Hash[Symbol, Symbol])
|
102
|
-
end
|