logstruct 0.0.2 → 0.1.1
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 +4 -22
- data/README.md +25 -2
- 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 +126 -13
- data/lib/log_struct/concerns/error_handling.rb +3 -7
- data/lib/log_struct/concerns/logging.rb +5 -5
- data/lib/log_struct/config_struct/filters.rb +18 -0
- data/lib/log_struct/config_struct/integrations.rb +16 -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 +49 -0
- 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 +54 -0
- 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 +482 -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 +25 -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 +94 -0
- 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 +88 -0
- 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 -46
- 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 +4 -0
- 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 -25
- data/lib/log_struct/log/shared/serialize_common.rb +1 -33
- data/lib/log_struct/log/shared/serialize_common_public.rb +44 -0
- 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 +31 -32
- 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 +123 -0
- data/lib/log_struct/railtie.rb +71 -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 +22 -4
- data/logstruct.gemspec +3 -0
- metadata +108 -5
- data/lib/log_struct/log/interfaces/message_field.rb +0 -20
- data/lib/log_struct/log_keys.rb +0 -102
@@ -0,0 +1,39 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LogStruct
|
5
|
+
module Log
|
6
|
+
module Interfaces
|
7
|
+
module RequestFields
|
8
|
+
extend T::Sig
|
9
|
+
extend T::Helpers
|
10
|
+
|
11
|
+
interface!
|
12
|
+
|
13
|
+
sig { abstract.returns(T.nilable(String)) }
|
14
|
+
def path
|
15
|
+
end
|
16
|
+
|
17
|
+
sig { abstract.returns(T.nilable(String)) }
|
18
|
+
def http_method
|
19
|
+
end
|
20
|
+
|
21
|
+
sig { abstract.returns(T.nilable(String)) }
|
22
|
+
def source_ip
|
23
|
+
end
|
24
|
+
|
25
|
+
sig { abstract.returns(T.nilable(String)) }
|
26
|
+
def user_agent
|
27
|
+
end
|
28
|
+
|
29
|
+
sig { abstract.returns(T.nilable(String)) }
|
30
|
+
def referer
|
31
|
+
end
|
32
|
+
|
33
|
+
sig { abstract.returns(T.nilable(String)) }
|
34
|
+
def request_id
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -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,6 +20,7 @@ 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
|
28
26
|
class Error < StandardError; end
|
@@ -34,4 +32,24 @@ module LogStruct
|
|
34
32
|
# Set enabled at require time based on current Rails environment.
|
35
33
|
# (Users can disable or enable LogStruct later in an initializer.)
|
36
34
|
set_enabled_from_rails_env!
|
35
|
+
|
36
|
+
# Silence Rails boot banners for cleaner server output
|
37
|
+
LogStruct::RailsBootBannerSilencer.install!
|
38
|
+
|
39
|
+
# Patch Puma immediately for server runs so we can convert its lifecycle
|
40
|
+
# messages into structured logs reliably.
|
41
|
+
if ARGV.include?("server")
|
42
|
+
begin
|
43
|
+
require "log_struct/integrations/puma"
|
44
|
+
LogStruct::Integrations::Puma.install_patches!
|
45
|
+
|
46
|
+
# Patches installed now; Rack handler patch covers server boot path
|
47
|
+
rescue => e
|
48
|
+
if defined?(::Rails) && ::Rails.respond_to?(:env) && ::Rails.env.test?
|
49
|
+
raise e
|
50
|
+
else
|
51
|
+
LogStruct.handle_exception(e, source: LogStruct::Source::Puma)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
37
55
|
end
|
data/logstruct.gemspec
CHANGED
@@ -47,6 +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", ">= 4.1", "< 6.0"
|
51
|
+
spec.add_development_dependency "active_model_serializers", "~> 0.10.13"
|
52
|
+
spec.add_development_dependency "dotenv-rails", "~> 3.1"
|
50
53
|
|
51
54
|
spec.metadata["rubygems_mfa_required"] = "true"
|
52
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.
|
4
|
+
version: 0.1.1
|
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
|
@@ -177,6 +177,54 @@ dependencies:
|
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0.5'
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
name: ahoy_matey
|
182
|
+
requirement: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '4.1'
|
187
|
+
- - "<"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '6.0'
|
190
|
+
type: :development
|
191
|
+
prerelease: false
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '4.1'
|
197
|
+
- - "<"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '6.0'
|
200
|
+
- !ruby/object:Gem::Dependency
|
201
|
+
name: active_model_serializers
|
202
|
+
requirement: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - "~>"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.10.13
|
207
|
+
type: :development
|
208
|
+
prerelease: false
|
209
|
+
version_requirements: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - "~>"
|
212
|
+
- !ruby/object:Gem::Version
|
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'
|
180
228
|
description: An opinionated and type-safe structured logging solution. Configures
|
181
229
|
any Rails app to log JSON to stdout. Structured logging is automatically configured
|
182
230
|
for many gems, including Sidekiq, Carrierwave, Shrine, etc. Log messages, params,
|
@@ -191,6 +239,8 @@ files:
|
|
191
239
|
- LICENSE
|
192
240
|
- README.md
|
193
241
|
- lib/log_struct.rb
|
242
|
+
- lib/log_struct/boot_buffer.rb
|
243
|
+
- lib/log_struct/builders/active_job.rb
|
194
244
|
- lib/log_struct/concerns/configuration.rb
|
195
245
|
- lib/log_struct/concerns/error_handling.rb
|
196
246
|
- lib/log_struct/concerns/logging.rb
|
@@ -203,6 +253,7 @@ files:
|
|
203
253
|
- lib/log_struct/enums/error_reporter.rb
|
204
254
|
- lib/log_struct/enums/event.rb
|
205
255
|
- lib/log_struct/enums/level.rb
|
256
|
+
- lib/log_struct/enums/log_field.rb
|
206
257
|
- lib/log_struct/enums/source.rb
|
207
258
|
- lib/log_struct/formatter.rb
|
208
259
|
- lib/log_struct/handlers.rb
|
@@ -215,15 +266,19 @@ files:
|
|
215
266
|
- lib/log_struct/integrations/action_mailer/metadata_collection.rb
|
216
267
|
- lib/log_struct/integrations/active_job.rb
|
217
268
|
- lib/log_struct/integrations/active_job/log_subscriber.rb
|
269
|
+
- lib/log_struct/integrations/active_model_serializers.rb
|
218
270
|
- lib/log_struct/integrations/active_record.rb
|
219
271
|
- lib/log_struct/integrations/active_storage.rb
|
272
|
+
- lib/log_struct/integrations/ahoy.rb
|
220
273
|
- lib/log_struct/integrations/carrierwave.rb
|
274
|
+
- lib/log_struct/integrations/dotenv.rb
|
221
275
|
- lib/log_struct/integrations/good_job.rb
|
222
276
|
- lib/log_struct/integrations/good_job/log_subscriber.rb
|
223
277
|
- lib/log_struct/integrations/good_job/logger.rb
|
224
278
|
- lib/log_struct/integrations/host_authorization.rb
|
225
279
|
- lib/log_struct/integrations/integration_interface.rb
|
226
280
|
- lib/log_struct/integrations/lograge.rb
|
281
|
+
- lib/log_struct/integrations/puma.rb
|
227
282
|
- lib/log_struct/integrations/rack.rb
|
228
283
|
- lib/log_struct/integrations/rack_error_handler.rb
|
229
284
|
- lib/log_struct/integrations/rack_error_handler/middleware.rb
|
@@ -233,33 +288,81 @@ files:
|
|
233
288
|
- lib/log_struct/integrations/sorbet.rb
|
234
289
|
- lib/log_struct/log.rb
|
235
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
|
236
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
|
298
|
+
- lib/log_struct/log/active_model_serializers.rb
|
237
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
|
307
|
+
- lib/log_struct/log/ahoy.rb
|
238
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
|
239
317
|
- lib/log_struct/log/error.rb
|
240
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
|
241
325
|
- lib/log_struct/log/interfaces/additional_data_field.rb
|
242
326
|
- lib/log_struct/log/interfaces/common_fields.rb
|
243
|
-
- lib/log_struct/log/interfaces/
|
327
|
+
- lib/log_struct/log/interfaces/public_common_fields.rb
|
244
328
|
- lib/log_struct/log/interfaces/request_fields.rb
|
245
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
|
246
333
|
- lib/log_struct/log/request.rb
|
247
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
|
248
338
|
- lib/log_struct/log/shared/add_request_fields.rb
|
249
339
|
- lib/log_struct/log/shared/merge_additional_data_fields.rb
|
250
340
|
- lib/log_struct/log/shared/serialize_common.rb
|
341
|
+
- lib/log_struct/log/shared/serialize_common_public.rb
|
251
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
|
252
348
|
- lib/log_struct/log/sidekiq.rb
|
253
349
|
- lib/log_struct/log/sql.rb
|
254
|
-
- lib/log_struct/log_keys.rb
|
255
350
|
- lib/log_struct/monkey_patches/active_support/tagged_logging/formatter.rb
|
256
351
|
- lib/log_struct/multi_error_reporter.rb
|
257
352
|
- lib/log_struct/param_filters.rb
|
353
|
+
- lib/log_struct/rails_boot_banner_silencer.rb
|
258
354
|
- lib/log_struct/railtie.rb
|
259
355
|
- lib/log_struct/semantic_logger/color_formatter.rb
|
260
356
|
- lib/log_struct/semantic_logger/formatter.rb
|
261
357
|
- lib/log_struct/semantic_logger/logger.rb
|
262
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
|
263
366
|
- lib/log_struct/sorbet.rb
|
264
367
|
- lib/log_struct/sorbet/serialize_symbol_keys.rb
|
265
368
|
- lib/log_struct/string_scrubber.rb
|
@@ -288,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
391
|
- !ruby/object:Gem::Version
|
289
392
|
version: '0'
|
290
393
|
requirements: []
|
291
|
-
rubygems_version: 3.6.
|
394
|
+
rubygems_version: 3.6.9
|
292
395
|
specification_version: 4
|
293
396
|
summary: Type-Safe JSON Structured Logging for Rails Apps
|
294
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
|