logstruct 0.3.0 → 0.4.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/lib/log_struct/concerns/configuration.rb +2 -2
  4. data/lib/log_struct/config_struct/filters.rb +2 -5
  5. data/lib/log_struct/enums/level.rb +1 -1
  6. data/lib/log_struct/integrations/action_mailer/event_logging.rb +1 -0
  7. data/lib/log_struct/integrations/action_mailer/metadata_collection.rb +1 -0
  8. data/lib/log_struct/integrations/active_record.rb +1 -1
  9. data/lib/log_struct/integrations/ahoy.rb +1 -1
  10. data/lib/log_struct/integrations/carrierwave.rb +1 -0
  11. data/lib/log_struct/integrations/dotenv.rb +2 -1
  12. data/lib/log_struct/integrations/good_job.rb +2 -1
  13. data/lib/log_struct/integrations/host_authorization.rb +3 -6
  14. data/lib/log_struct/integrations/lograge.rb +19 -22
  15. data/lib/log_struct/integrations/puma.rb +1 -1
  16. data/lib/log_struct/integrations/rack_error_handler/error_lines.rb +1 -4
  17. data/lib/log_struct/integrations/shrine.rb +1 -1
  18. data/lib/log_struct/log/action_mailer/delivered.rb +9 -7
  19. data/lib/log_struct/log/action_mailer/delivery.rb +9 -7
  20. data/lib/log_struct/log/action_mailer/error.rb +9 -7
  21. data/lib/log_struct/log/action_mailer.rb +1 -0
  22. data/lib/log_struct/log/active_job/discard.rb +7 -5
  23. data/lib/log_struct/log/active_job/enqueue.rb +7 -5
  24. data/lib/log_struct/log/active_job/error.rb +7 -5
  25. data/lib/log_struct/log/active_job/finish.rb +7 -5
  26. data/lib/log_struct/log/active_job/retry.rb +7 -5
  27. data/lib/log_struct/log/active_job/retry_stopped.rb +7 -5
  28. data/lib/log_struct/log/active_job/schedule.rb +7 -5
  29. data/lib/log_struct/log/active_job/start.rb +7 -5
  30. data/lib/log_struct/log/active_job.rb +1 -0
  31. data/lib/log_struct/log/active_model_serializers.rb +7 -5
  32. data/lib/log_struct/log/active_storage/delete.rb +7 -5
  33. data/lib/log_struct/log/active_storage/download.rb +7 -5
  34. data/lib/log_struct/log/active_storage/exist.rb +7 -5
  35. data/lib/log_struct/log/active_storage/metadata.rb +7 -5
  36. data/lib/log_struct/log/active_storage/upload.rb +7 -5
  37. data/lib/log_struct/log/active_storage/url.rb +7 -5
  38. data/lib/log_struct/log/active_storage.rb +1 -0
  39. data/lib/log_struct/log/ahoy.rb +7 -5
  40. data/lib/log_struct/log/carrierwave/delete.rb +7 -5
  41. data/lib/log_struct/log/carrierwave/download.rb +7 -5
  42. data/lib/log_struct/log/carrierwave/upload.rb +7 -5
  43. data/lib/log_struct/log/carrierwave.rb +1 -0
  44. data/lib/log_struct/log/dotenv/load.rb +7 -5
  45. data/lib/log_struct/log/dotenv/restore.rb +7 -5
  46. data/lib/log_struct/log/dotenv/save.rb +7 -5
  47. data/lib/log_struct/log/dotenv/update.rb +7 -5
  48. data/lib/log_struct/log/error.rb +15 -15
  49. data/lib/log_struct/log/good_job/error.rb +7 -5
  50. data/lib/log_struct/log/good_job/log.rb +7 -5
  51. data/lib/log_struct/log/good_job.rb +1 -0
  52. data/lib/log_struct/log/plain.rb +9 -7
  53. data/lib/log_struct/log/puma/error.rb +9 -7
  54. data/lib/log_struct/log/puma/shutdown.rb +9 -7
  55. data/lib/log_struct/log/puma/start.rb +9 -7
  56. data/lib/log_struct/log/request.rb +15 -15
  57. data/lib/log_struct/log/security/blocked_host.rb +15 -15
  58. data/lib/log_struct/log/security/csrf_violation.rb +15 -15
  59. data/lib/log_struct/log/security/ip_spoof.rb +15 -15
  60. data/lib/log_struct/log/security.rb +1 -0
  61. data/lib/log_struct/log/shrine/delete.rb +7 -5
  62. data/lib/log_struct/log/shrine/download.rb +7 -5
  63. data/lib/log_struct/log/shrine/exist.rb +7 -5
  64. data/lib/log_struct/log/shrine/metadata.rb +7 -5
  65. data/lib/log_struct/log/shrine/upload.rb +7 -5
  66. data/lib/log_struct/log/sidekiq/error.rb +9 -7
  67. data/lib/log_struct/log/sidekiq/log.rb +9 -7
  68. data/lib/log_struct/log/sql.rb +9 -7
  69. data/lib/log_struct/monkey_patches/active_support/tagged_logging/formatter.rb +1 -0
  70. data/lib/log_struct/multi_error_reporter.rb +1 -1
  71. data/lib/log_struct/params_errors.rb +7 -10
  72. data/lib/log_struct/rails_boot_banner_silencer.rb +1 -0
  73. data/lib/log_struct/semantic_logger/concerns/log_methods.rb +1 -0
  74. data/lib/log_struct/semantic_logger/formatter.rb +1 -1
  75. data/lib/log_struct/semantic_logger/logger.rb +1 -1
  76. data/lib/log_struct/semantic_logger/setup.rb +1 -4
  77. data/lib/log_struct/string_scrubber.rb +1 -1
  78. data/lib/log_struct/version.rb +1 -1
  79. data/logstruct.gemspec +1 -1
  80. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 647c97ba4368b67d39333204ca35a5161b0905dda2c8ef72d01e15d58665d367
4
- data.tar.gz: e86e688d516ef584c5f8994ecb0739599c09595a021ebc949f494e6d631f349d
3
+ metadata.gz: b257a68c1c28d1475a75a22d5114ad27325c6da9c327edb4eba4a035a2ec3de0
4
+ data.tar.gz: f32b4ea82a198a0a7bae0b6454411ddd28ddf92ae09d96948d02074399cc242c
5
5
  SHA512:
6
- metadata.gz: 6709f7868f43c348891761749400bb93c762e3df6f2d7093dab12f51c50a2ce33e26bfd94dab009093a1c4207f746735764c56ce20768394a9b8e81cce5d346d
7
- data.tar.gz: 7ab05d71a64c08cd4ad747c7684d3b75553e2740c0539cefa2cab2f906f2c5023dd8696bb78129790472896f83008addde117f9e41229d563ad9003a76911fd9
6
+ metadata.gz: 53ded423b2a206e38da2799efa3a5a8687a68acc86da9270548bd1e08e722cf2862604733f413e71e88d9d8d54ae637e1b7316b893fd1ee4a81e0e0f42fd8efc
7
+ data.tar.gz: 5fde1dfdb59100833384f59126d64b0cd5466abcc4304278f1312c3bca2fad6f0461b16f47720c142600c6f8e059faf27f032b235d9c34e400fc08738fb29382
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-11-06
11
+
12
+ ### Changed
13
+
14
+ - **Breaking**: Requires `sorbet-runtime` 0.6.12698 or later, the first version with `T::Module`, which `LogStruct::SemanticLogger::Logger`'s signature uses.
15
+ - **Breaking**: Log structs mark the props that implement their interfaces with `override: true`, which current versions of Sorbet require. A custom log struct needs the same on its `level`, `timestamp` and `additional_data` props, with the interfaces included above them.
16
+ - **Development**: Update the locked gems and the docs and tooling packages, including Sorbet 0.6, Tapioca 0.20 and RuboCop 1.91. CI tests Rails 7.2.4, 8.0.5.2 and 8.1.4.1.
17
+ - **Development**: `task ci` runs `jscpd`. GitHub CI runs the dependency audits, and a release waits for them.
18
+
19
+ ### Fixed
20
+
21
+ - **Development**: Update the locked `crass` dependency to 1.0.8, which fixes GHSA-pq4g-8rxf-4g29, and move `glob` and `minimatch` in the development tools to patched versions.
22
+ - **Generation**: An interrupted run leaves the generated files as they were, because they're written to a staging directory and moved into place.
23
+
10
24
  ## [0.3.0] - 2026-10-23
11
25
 
12
26
  ### Changed
@@ -12,7 +12,7 @@ module LogStruct
12
12
  module ClassMethods
13
13
  extend T::Sig
14
14
 
15
- CONSOLE_COMMAND_ARGS = T.let(["console", "c"].freeze, T::Array[String])
15
+ CONSOLE_COMMAND_ARGS = ["console", "c"].freeze
16
16
  EMPTY_ARGV = T.let([].freeze, T::Array[String])
17
17
  RAILS_PATTERNS_LABEL = "Rails filter_parameters"
18
18
  RAILS_REGEXPS_LABEL = "Rails filter_parameters (Regexps)"
@@ -237,7 +237,7 @@ module LogStruct
237
237
  # there or from the field's value down, as it would in Rails.
238
238
  sig { params(patterns: T::Array[T.untyped]).returns(ConfigStruct::PathFilterMatcher) }
239
239
  def build_rails_path_matcher(patterns)
240
- regexps = patterns.select { |entry| entry.is_a?(Regexp) }
240
+ regexps = patterns.grep(Regexp)
241
241
  strings = patterns.reject { |entry| entry.is_a?(Regexp) }.map { |entry| Regexp.escape(entry.to_s) }
242
242
  regexps << Regexp.new(strings.join("|"), true) if strings.any?
243
243
  callable = Kernel.lambda do |path, _value, _root|
@@ -62,7 +62,7 @@ module LogStruct
62
62
  class LazyRoot
63
63
  extend T::Sig
64
64
 
65
- UNAVAILABLE = T.let(Object.new.freeze, Object)
65
+ UNAVAILABLE = Object.new.freeze
66
66
 
67
67
  sig { params(value: T.untyped).void }
68
68
  def initialize(value)
@@ -187,10 +187,7 @@ module LogStruct
187
187
  # - api_key, secret_key, private_key, access_key, encryption_key, signing_key, master_key: X-Api-Key
188
188
  # - signature, sig, salt and certificate as the last word: X-Amz-Signature (but not signature_field_id)
189
189
  # Matching whole words avoids false positives like "keyboard", "author" or "cron_key".
190
- DEFAULT_SENSITIVE_KEY_PATTERN = T.let(
191
- /(?:\A|_)(?:passwords?|passwd|passphrases?|passcodes?|pwd|tokens?|secrets?|auth|authorization|authentication|creds?|credentials?|cookies?|sessions?|jwts?|bearer|otps?|apikeys?|cvv|cvc|ssn|social_security(?:_numbers?)?|credit_cards?|card_numbers?|crypt|crypted)(?:_|\z)|(?:\A|_)(?:api|secret|private|access|encryption|signing|master)_keys?(?:_|\z)|(?:\A|_)(?:signature|sig|salt|certificate)s?\z/,
192
- Regexp
193
- )
190
+ DEFAULT_SENSITIVE_KEY_PATTERN = /(?:\A|_)(?:passwords?|passwd|passphrases?|passcodes?|pwd|tokens?|secrets?|auth|authorization|authentication|creds?|credentials?|cookies?|sessions?|jwts?|bearer|otps?|apikeys?|cvv|cvc|ssn|social_security(?:_numbers?)?|credit_cards?|card_numbers?|crypt|crypted)(?:_|\z)|(?:\A|_)(?:api|secret|private|access|encryption|signing|master)_keys?(?:_|\z)|(?:\A|_)(?:signature|sig|salt|certificate)s?\z/
194
191
 
195
192
  # Matchers for keys that aren't listed by name in filter_keys. Each matcher receives the key (String)
196
193
  # and optional value, returning true when the pair should be filtered. Includes a regex matcher for
@@ -32,7 +32,7 @@ module LogStruct
32
32
  end
33
33
 
34
34
  # Convert a string or integer severity to a Level
35
- sig { params(severity: T.any(String, Symbol, Integer, NilClass)).returns(Level) }
35
+ sig { params(severity: T.nilable(T.any(String, Symbol, Integer))).returns(Level) }
36
36
  def self.from_severity(severity)
37
37
  return Unknown if severity.nil?
38
38
  return from_severity_int(severity) if severity.is_a?(Integer)
@@ -9,6 +9,7 @@ module LogStruct
9
9
  extend ActiveSupport::Concern
10
10
  extend T::Sig
11
11
  extend T::Helpers
12
+
12
13
  requires_ancestor { ::ActionMailer::Base }
13
14
  requires_ancestor { ErrorHandling }
14
15
 
@@ -7,6 +7,7 @@ module LogStruct
7
7
  # Handles collection of metadata for email logging
8
8
  module MetadataCollection
9
9
  extend T::Sig
10
+
10
11
  # Add message-specific metadata to log data
11
12
  sig { params(mailer: T.untyped, log_data: T::Hash[Symbol, T.untyped]).void }
12
13
  def self.add_message_metadata(mailer, log_data)
@@ -43,7 +43,7 @@ module LogStruct
43
43
 
44
44
  # Track subscription state keyed to the current Notifications.notifier instance
45
45
  State = ::Struct.new(:subscribed, :notifier_id)
46
- STATE = T.let(State.new(false, nil), State)
46
+ STATE = State.new(false, nil)
47
47
 
48
48
  # Set up SQL query logging integration
49
49
  sig { override.params(config: LogStruct::Configuration).returns(T.nilable(T::Boolean)) }
@@ -20,7 +20,7 @@ module LogStruct
20
20
 
21
21
  # Takes whatever Ahoy's track takes and passes it on as given, so Ahoy's defaults still apply
22
22
  sig { params(name: T.untyped, args: T.untyped).returns(T.untyped) }
23
- def track(name, *args)
23
+ def track(name, *args) # rubocop:disable Sorbet/BlockMethodDefinition -- it's prepended and calls implicit super, which define_method can't do
24
24
  result = super
25
25
  begin
26
26
  LogStruct.info(
@@ -35,6 +35,7 @@ module LogStruct
35
35
  module LoggingMethods
36
36
  extend T::Sig
37
37
  extend T::Helpers
38
+
38
39
  requires_ancestor { ::CarrierWave::Uploader::Base }
39
40
 
40
41
  sig { params(args: T.untyped).returns(T.untyped) }
@@ -17,11 +17,12 @@ module LogStruct
17
17
  module Dotenv
18
18
  extend T::Sig
19
19
  extend IntegrationInterface
20
+
20
21
  @original_logger_setter = T.let(nil, T.nilable(UnboundMethod))
21
22
 
22
23
  # Internal state holder to avoid duplicate subscriptions in a Sorbet-friendly way
23
24
  State = ::Struct.new(:subscribed)
24
- STATE = T.let(State.new(false), State)
25
+ STATE = State.new(false)
25
26
 
26
27
  sig { override.params(config: LogStruct::Configuration).returns(T.nilable(T::Boolean)) }
27
28
  def self.setup(config)
@@ -157,7 +157,8 @@ module LogStruct
157
157
  return true unless defined?(::GoodJob::Notifier::CONNECTION_ERRORS)
158
158
 
159
159
  ::GoodJob::Notifier::CONNECTION_ERRORS.any? do |error_name|
160
- error_class = error_name.safe_constantize
160
+ # CONNECTION_ERRORS holds class names, because an app might not have loaded the database adapter they belong to
161
+ error_class = error_name.safe_constantize # rubocop:disable Sorbet/ConstantsFromStrings
161
162
  error_class.is_a?(Class) && exception.is_a?(error_class)
162
163
  end
163
164
  end
@@ -12,14 +12,11 @@ module LogStruct
12
12
  extend T::Sig
13
13
  extend IntegrationInterface
14
14
 
15
- RESPONSE_HTML = T.let(
16
- "<html><head><title>Blocked Host</title></head><body>" \
15
+ RESPONSE_HTML = "<html><head><title>Blocked Host</title></head><body>" \
17
16
  "<h1>Blocked Host</h1>" \
18
17
  "<p>This host is not permitted to access this application.</p>" \
19
18
  "<p>If you are the administrator, check your configuration.</p>" \
20
- "</body></html>",
21
- String
22
- )
19
+ "</body></html>"
23
20
  RESPONSE_HEADERS = T.let(
24
21
  {
25
22
  "Content-Type" => "text/html",
@@ -27,7 +24,7 @@ module LogStruct
27
24
  }.freeze,
28
25
  T::Hash[String, String]
29
26
  )
30
- FORBIDDEN_STATUS = T.let(403, Integer)
27
+ FORBIDDEN_STATUS = 403
31
28
 
32
29
  # Set up host authorization logging
33
30
  sig { override.params(config: LogStruct::Configuration).returns(T.nilable(T::Boolean)) }
@@ -14,28 +14,25 @@ module LogStruct
14
14
  module Lograge
15
15
  extend IntegrationInterface
16
16
 
17
- LOGRAGE_KNOWN_KEYS = T.let(
18
- [
19
- :method,
20
- :path,
21
- :format,
22
- :controller,
23
- :action,
24
- :status,
25
- :duration,
26
- :view,
27
- :db,
28
- :params,
29
- :request_id,
30
- :source_ip,
31
- :user_agent,
32
- :referer,
33
- :host,
34
- :content_type,
35
- :accept
36
- ].freeze,
37
- T::Array[Symbol]
38
- )
17
+ LOGRAGE_KNOWN_KEYS = [
18
+ :method,
19
+ :path,
20
+ :format,
21
+ :controller,
22
+ :action,
23
+ :status,
24
+ :duration,
25
+ :view,
26
+ :db,
27
+ :params,
28
+ :request_id,
29
+ :source_ip,
30
+ :user_agent,
31
+ :referer,
32
+ :host,
33
+ :content_type,
34
+ :accept
35
+ ].freeze
39
36
 
40
37
  # With config.exceptions_app = routes, Rails renders an error page by sending the request through the app again
41
38
  # as GET /<status>, and keeps the request's own method and path in these headers
@@ -196,7 +196,7 @@ module LogStruct
196
196
  return true
197
197
  end
198
198
 
199
- if (m = l.match(/^(?:\*\s*)?Puma version: (\S+)(?:.*"([^\"]+)")?/))
199
+ if (m = l.match(/^(?:\*\s*)?Puma version: (\S+)(?:.*"([^"]+)")?/))
200
200
  T.cast(STATE[:start_info], T::Hash[Symbol, T.untyped])[:puma_version] = m[1]
201
201
  if m[2]
202
202
  T.cast(STATE[:start_info], T::Hash[Symbol, T.untyped])[:puma_codename] = m[2]
@@ -12,10 +12,7 @@ module LogStruct
12
12
  module ErrorLines
13
13
  extend T::Sig
14
14
 
15
- CSRF_ERROR_NAMES = T.let(
16
- ["ActionController::InvalidAuthenticityToken", "ActionController::InvalidCrossOriginRequest"].freeze,
17
- T::Array[String]
18
- )
15
+ CSRF_ERROR_NAMES = ["ActionController::InvalidAuthenticityToken", "ActionController::InvalidCrossOriginRequest"].freeze
19
16
 
20
17
  sig { returns(T::Boolean) }
21
18
  def self.enabled?
@@ -14,7 +14,7 @@ module LogStruct
14
14
  extend T::Sig
15
15
  extend IntegrationInterface
16
16
 
17
- SHRINE_EVENTS = T.let(%i[upload exists download delete metadata open].freeze, T::Array[Symbol])
17
+ SHRINE_EVENTS = %i[upload exists download delete metadata open].freeze
18
18
 
19
19
  # The file name in a Content-Disposition (attachment; filename="..."; filename*=UTF-8''...). A quoted name
20
20
  # can hold a semicolon, and whatever follows a quote (malformed or not) goes too.
@@ -23,11 +23,15 @@ module LogStruct
23
23
  class Delivered < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+ include LogStruct::Log::Interfaces::AdditionalDataField
29
+
26
30
  # Shared/common fields
27
- const :source, Source::Mailer, default: Source::Mailer
28
- const :event, Event, default: Event::Delivered
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
31
+ const :source, Source::Mailer, default: Source::Mailer, override: true
32
+ const :event, Event, default: Event::Delivered, override: true
33
+ const :timestamp, Time, factory: -> { Time.now }, override: true
34
+ const :level, Level, default: Level::Info, override: true
31
35
 
32
36
  const :to, T.nilable(T::Array[String]), default: nil
33
37
  const :from, T.nilable(String), default: nil
@@ -38,8 +42,7 @@ module LogStruct
38
42
  const :attachment_count, T.nilable(Integer), default: nil
39
43
 
40
44
  # Additional data
41
- include LogStruct::Log::Interfaces::AdditionalDataField
42
- const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
45
+ const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
43
46
  include LogStruct::Log::Shared::MergeAdditionalDataFields
44
47
 
45
48
  FIELD_KEYS = T.let(
@@ -53,7 +56,6 @@ module LogStruct
53
56
  end
54
57
 
55
58
  # Serialize shared fields
56
- include LogStruct::Log::Interfaces::CommonFields
57
59
  include LogStruct::Log::Shared::SerializeCommon
58
60
 
59
61
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,15 @@ module LogStruct
23
23
  class Delivery < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+ include LogStruct::Log::Interfaces::AdditionalDataField
29
+
26
30
  # Shared/common fields
27
- const :source, Source::Mailer, default: Source::Mailer
28
- const :event, Event, default: Event::Delivery
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
31
+ const :source, Source::Mailer, default: Source::Mailer, override: true
32
+ const :event, Event, default: Event::Delivery, override: true
33
+ const :timestamp, Time, factory: -> { Time.now }, override: true
34
+ const :level, Level, default: Level::Info, override: true
31
35
 
32
36
  const :to, T.nilable(T::Array[String]), default: nil
33
37
  const :from, T.nilable(String), default: nil
@@ -38,8 +42,7 @@ module LogStruct
38
42
  const :attachment_count, T.nilable(Integer), default: nil
39
43
 
40
44
  # Additional data
41
- include LogStruct::Log::Interfaces::AdditionalDataField
42
- const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
45
+ const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
43
46
  include LogStruct::Log::Shared::MergeAdditionalDataFields
44
47
 
45
48
  FIELD_KEYS = T.let(
@@ -53,7 +56,6 @@ module LogStruct
53
56
  end
54
57
 
55
58
  # Serialize shared fields
56
- include LogStruct::Log::Interfaces::CommonFields
57
59
  include LogStruct::Log::Shared::SerializeCommon
58
60
 
59
61
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,15 @@ module LogStruct
23
23
  class Error < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+ include LogStruct::Log::Interfaces::AdditionalDataField
29
+
26
30
  # Shared/common fields
27
- const :source, Source::Mailer, default: Source::Mailer
28
- const :event, Event, default: Event::Error
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
31
+ const :source, Source::Mailer, default: Source::Mailer, override: true
32
+ const :event, Event, default: Event::Error, override: true
33
+ const :timestamp, Time, factory: -> { Time.now }, override: true
34
+ const :level, Level, default: Level::Info, override: true
31
35
 
32
36
  const :to, T.nilable(T::Array[String]), default: nil
33
37
  const :from, T.nilable(String), default: nil
@@ -43,8 +47,7 @@ module LogStruct
43
47
  const :backtrace, T.nilable(T::Array[String]), default: nil
44
48
 
45
49
  # Additional data
46
- include LogStruct::Log::Interfaces::AdditionalDataField
47
- const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
50
+ const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
48
51
  include LogStruct::Log::Shared::MergeAdditionalDataFields
49
52
 
50
53
  FIELD_KEYS = T.let(
@@ -58,7 +61,6 @@ module LogStruct
58
61
  end
59
62
 
60
63
  # Serialize shared fields
61
- include LogStruct::Log::Interfaces::CommonFields
62
64
  include LogStruct::Log::Shared::SerializeCommon
63
65
 
64
66
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -15,6 +15,7 @@ module LogStruct
15
15
  class ActionMailer
16
16
  class BaseFields < T::Struct
17
17
  extend T::Sig
18
+
18
19
  const :to, T.nilable(T::Array[String]), default: nil
19
20
  const :from, T.nilable(String), default: nil
20
21
  const :subject, T.nilable(String), default: nil
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Discard < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Discard
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Discard, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -41,7 +44,6 @@ module LogStruct
41
44
  const :message, String
42
45
 
43
46
  # Serialize shared fields
44
- include LogStruct::Log::Interfaces::CommonFields
45
47
  include LogStruct::Log::Shared::SerializeCommon
46
48
 
47
49
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Enqueue < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Enqueue
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Enqueue, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -37,7 +40,6 @@ module LogStruct
37
40
  const :provider_job_id, T.nilable(String), default: nil
38
41
 
39
42
  # Serialize shared fields
40
- include LogStruct::Log::Interfaces::CommonFields
41
43
  include LogStruct::Log::Shared::SerializeCommon
42
44
 
43
45
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Error < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Error
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Error, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -42,7 +45,6 @@ module LogStruct
42
45
  const :backtrace, T.nilable(T::Array[String]), default: nil
43
46
 
44
47
  # Serialize shared fields
45
- include LogStruct::Log::Interfaces::CommonFields
46
48
  include LogStruct::Log::Shared::SerializeCommon
47
49
 
48
50
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Finish < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Finish
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Finish, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -41,7 +44,6 @@ module LogStruct
41
44
  const :finished_at, Time
42
45
 
43
46
  # Serialize shared fields
44
- include LogStruct::Log::Interfaces::CommonFields
45
47
  include LogStruct::Log::Shared::SerializeCommon
46
48
 
47
49
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Retry < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Retry
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Retry, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -42,7 +45,6 @@ module LogStruct
42
45
  const :wait_ms, T.nilable(Float), default: nil
43
46
 
44
47
  # Serialize shared fields
45
- include LogStruct::Log::Interfaces::CommonFields
46
48
  include LogStruct::Log::Shared::SerializeCommon
47
49
 
48
50
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class RetryStopped < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::RetryStopped
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::RetryStopped, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -41,7 +44,6 @@ module LogStruct
41
44
  const :message, String
42
45
 
43
46
  # Serialize shared fields
44
- include LogStruct::Log::Interfaces::CommonFields
45
47
  include LogStruct::Log::Shared::SerializeCommon
46
48
 
47
49
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Schedule < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Schedule
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Schedule, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -40,7 +43,6 @@ module LogStruct
40
43
  const :scheduled_at, Time
41
44
 
42
45
  # Serialize shared fields
43
- include LogStruct::Log::Interfaces::CommonFields
44
46
  include LogStruct::Log::Shared::SerializeCommon
45
47
 
46
48
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -23,11 +23,14 @@ module LogStruct
23
23
  class Start < T::Struct
24
24
  extend T::Sig
25
25
 
26
+ # A prop marked `override` needs the method it implements to exist already
27
+ include LogStruct::Log::Interfaces::CommonFields
28
+
26
29
  # Shared/common fields
27
- const :source, Source::Job, default: Source::Job
28
- const :event, Event, default: Event::Start
29
- const :timestamp, Time, factory: -> { Time.now }
30
- const :level, Level, default: Level::Info
30
+ const :source, Source::Job, default: Source::Job, override: true
31
+ const :event, Event, default: Event::Start, override: true
32
+ const :timestamp, Time, factory: -> { Time.now }, override: true
33
+ const :level, Level, default: Level::Info, override: true
31
34
 
32
35
  const :job_id, String
33
36
  const :job_class, String
@@ -41,7 +44,6 @@ module LogStruct
41
44
  const :attempt, T.nilable(Integer), default: nil
42
45
 
43
46
  # Serialize shared fields
44
- include LogStruct::Log::Interfaces::CommonFields
45
47
  include LogStruct::Log::Shared::SerializeCommon
46
48
 
47
49
  sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
@@ -20,6 +20,7 @@ module LogStruct
20
20
  class ActiveJob
21
21
  class BaseFields < T::Struct
22
22
  extend T::Sig
23
+
23
24
  const :job_id, String
24
25
  const :job_class, String
25
26
  const :queue_name, T.nilable(Symbol), default: nil