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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/log_struct/concerns/configuration.rb +2 -2
- data/lib/log_struct/config_struct/filters.rb +2 -5
- data/lib/log_struct/enums/level.rb +1 -1
- data/lib/log_struct/integrations/action_mailer/event_logging.rb +1 -0
- data/lib/log_struct/integrations/action_mailer/metadata_collection.rb +1 -0
- data/lib/log_struct/integrations/active_record.rb +1 -1
- data/lib/log_struct/integrations/ahoy.rb +1 -1
- data/lib/log_struct/integrations/carrierwave.rb +1 -0
- data/lib/log_struct/integrations/dotenv.rb +2 -1
- data/lib/log_struct/integrations/good_job.rb +2 -1
- data/lib/log_struct/integrations/host_authorization.rb +3 -6
- data/lib/log_struct/integrations/lograge.rb +19 -22
- data/lib/log_struct/integrations/puma.rb +1 -1
- data/lib/log_struct/integrations/rack_error_handler/error_lines.rb +1 -4
- data/lib/log_struct/integrations/shrine.rb +1 -1
- data/lib/log_struct/log/action_mailer/delivered.rb +9 -7
- data/lib/log_struct/log/action_mailer/delivery.rb +9 -7
- data/lib/log_struct/log/action_mailer/error.rb +9 -7
- data/lib/log_struct/log/action_mailer.rb +1 -0
- data/lib/log_struct/log/active_job/discard.rb +7 -5
- data/lib/log_struct/log/active_job/enqueue.rb +7 -5
- data/lib/log_struct/log/active_job/error.rb +7 -5
- data/lib/log_struct/log/active_job/finish.rb +7 -5
- data/lib/log_struct/log/active_job/retry.rb +7 -5
- data/lib/log_struct/log/active_job/retry_stopped.rb +7 -5
- data/lib/log_struct/log/active_job/schedule.rb +7 -5
- data/lib/log_struct/log/active_job/start.rb +7 -5
- data/lib/log_struct/log/active_job.rb +1 -0
- data/lib/log_struct/log/active_model_serializers.rb +7 -5
- data/lib/log_struct/log/active_storage/delete.rb +7 -5
- data/lib/log_struct/log/active_storage/download.rb +7 -5
- data/lib/log_struct/log/active_storage/exist.rb +7 -5
- data/lib/log_struct/log/active_storage/metadata.rb +7 -5
- data/lib/log_struct/log/active_storage/upload.rb +7 -5
- data/lib/log_struct/log/active_storage/url.rb +7 -5
- data/lib/log_struct/log/active_storage.rb +1 -0
- data/lib/log_struct/log/ahoy.rb +7 -5
- data/lib/log_struct/log/carrierwave/delete.rb +7 -5
- data/lib/log_struct/log/carrierwave/download.rb +7 -5
- data/lib/log_struct/log/carrierwave/upload.rb +7 -5
- data/lib/log_struct/log/carrierwave.rb +1 -0
- data/lib/log_struct/log/dotenv/load.rb +7 -5
- data/lib/log_struct/log/dotenv/restore.rb +7 -5
- data/lib/log_struct/log/dotenv/save.rb +7 -5
- data/lib/log_struct/log/dotenv/update.rb +7 -5
- data/lib/log_struct/log/error.rb +15 -15
- data/lib/log_struct/log/good_job/error.rb +7 -5
- data/lib/log_struct/log/good_job/log.rb +7 -5
- data/lib/log_struct/log/good_job.rb +1 -0
- data/lib/log_struct/log/plain.rb +9 -7
- data/lib/log_struct/log/puma/error.rb +9 -7
- data/lib/log_struct/log/puma/shutdown.rb +9 -7
- data/lib/log_struct/log/puma/start.rb +9 -7
- data/lib/log_struct/log/request.rb +15 -15
- data/lib/log_struct/log/security/blocked_host.rb +15 -15
- data/lib/log_struct/log/security/csrf_violation.rb +15 -15
- data/lib/log_struct/log/security/ip_spoof.rb +15 -15
- data/lib/log_struct/log/security.rb +1 -0
- data/lib/log_struct/log/shrine/delete.rb +7 -5
- data/lib/log_struct/log/shrine/download.rb +7 -5
- data/lib/log_struct/log/shrine/exist.rb +7 -5
- data/lib/log_struct/log/shrine/metadata.rb +7 -5
- data/lib/log_struct/log/shrine/upload.rb +7 -5
- data/lib/log_struct/log/sidekiq/error.rb +9 -7
- data/lib/log_struct/log/sidekiq/log.rb +9 -7
- data/lib/log_struct/log/sql.rb +9 -7
- data/lib/log_struct/monkey_patches/active_support/tagged_logging/formatter.rb +1 -0
- data/lib/log_struct/multi_error_reporter.rb +1 -1
- data/lib/log_struct/params_errors.rb +7 -10
- data/lib/log_struct/rails_boot_banner_silencer.rb +1 -0
- data/lib/log_struct/semantic_logger/concerns/log_methods.rb +1 -0
- data/lib/log_struct/semantic_logger/formatter.rb +1 -1
- data/lib/log_struct/semantic_logger/logger.rb +1 -1
- data/lib/log_struct/semantic_logger/setup.rb +1 -4
- data/lib/log_struct/string_scrubber.rb +1 -1
- data/lib/log_struct/version.rb +1 -1
- data/logstruct.gemspec +1 -1
- metadata +3 -3
|
@@ -23,11 +23,15 @@ 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
|
+
include LogStruct::Log::Interfaces::AdditionalDataField
|
|
29
|
+
|
|
26
30
|
# Shared/common fields
|
|
27
|
-
const :source, Source::Puma, default: Source::Puma
|
|
28
|
-
const :event, Event, default: Event::Start
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
31
|
+
const :source, Source::Puma, default: Source::Puma, override: true
|
|
32
|
+
const :event, Event, default: Event::Start, override: true
|
|
33
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
34
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
35
|
|
|
32
36
|
# Event-specific fields
|
|
33
37
|
const :mode, T.nilable(String), default: nil
|
|
@@ -41,8 +45,7 @@ module LogStruct
|
|
|
41
45
|
const :listening_addresses, T.nilable(T::Array[String]), default: nil
|
|
42
46
|
|
|
43
47
|
# Additional data
|
|
44
|
-
|
|
45
|
-
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
|
|
48
|
+
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
|
|
46
49
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
47
50
|
|
|
48
51
|
FIELD_KEYS = T.let(
|
|
@@ -56,7 +59,6 @@ module LogStruct
|
|
|
56
59
|
end
|
|
57
60
|
|
|
58
61
|
# Serialize shared fields
|
|
59
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
60
62
|
include LogStruct::Log::Shared::SerializeCommon
|
|
61
63
|
|
|
62
64
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
|
@@ -22,17 +22,22 @@ module LogStruct
|
|
|
22
22
|
class Request < T::Struct
|
|
23
23
|
extend T::Sig
|
|
24
24
|
|
|
25
|
+
# A prop marked `override` needs the method it implements to exist already
|
|
26
|
+
include LogStruct::Log::Interfaces::CommonFields
|
|
27
|
+
include LogStruct::Log::Interfaces::AdditionalDataField
|
|
28
|
+
include LogStruct::Log::Interfaces::RequestFields
|
|
29
|
+
|
|
25
30
|
# Shared/common fields
|
|
26
|
-
const :source, Source::Rails, default: Source::Rails
|
|
27
|
-
const :event, Event, default: Event::Request
|
|
28
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
29
|
-
const :level, Level, default: Level::Info
|
|
31
|
+
const :source, Source::Rails, default: Source::Rails, override: true
|
|
32
|
+
const :event, Event, default: Event::Request, override: true
|
|
33
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
34
|
+
const :level, Level, default: Level::Info, override: true
|
|
30
35
|
|
|
31
|
-
const :path, T.nilable(String), default: nil
|
|
32
|
-
const :http_method, T.nilable(String), default: nil
|
|
33
|
-
const :source_ip, T.nilable(String), default: nil
|
|
34
|
-
const :user_agent, T.nilable(String), default: nil
|
|
35
|
-
const :referer, T.nilable(String), default: nil
|
|
36
|
+
const :path, T.nilable(String), default: nil, override: true
|
|
37
|
+
const :http_method, T.nilable(String), default: nil, override: true
|
|
38
|
+
const :source_ip, T.nilable(String), default: nil, override: true
|
|
39
|
+
const :user_agent, T.nilable(String), default: nil, override: true
|
|
40
|
+
const :referer, T.nilable(String), default: nil, override: true
|
|
36
41
|
|
|
37
42
|
# Event-specific fields
|
|
38
43
|
const :format, T.nilable(Symbol), default: nil
|
|
@@ -48,8 +53,7 @@ module LogStruct
|
|
|
48
53
|
const :accept, T.nilable(String), default: nil
|
|
49
54
|
|
|
50
55
|
# Additional data
|
|
51
|
-
|
|
52
|
-
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
|
|
56
|
+
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
|
|
53
57
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
54
58
|
|
|
55
59
|
FIELD_KEYS = T.let(
|
|
@@ -62,11 +66,7 @@ module LogStruct
|
|
|
62
66
|
FIELD_KEYS
|
|
63
67
|
end
|
|
64
68
|
|
|
65
|
-
# Request fields (optional)
|
|
66
|
-
include LogStruct::Log::Interfaces::RequestFields
|
|
67
|
-
|
|
68
69
|
# Serialize shared fields
|
|
69
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
70
70
|
include LogStruct::Log::Shared::SerializeCommon
|
|
71
71
|
include LogStruct::Log::Shared::AddRequestFields
|
|
72
72
|
|
|
@@ -23,17 +23,22 @@ module LogStruct
|
|
|
23
23
|
class BlockedHost < 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
|
+
include LogStruct::Log::Interfaces::RequestFields
|
|
30
|
+
|
|
26
31
|
# Shared/common fields
|
|
27
|
-
const :source, Source::Security, default: Source::Security
|
|
28
|
-
const :event, Event, default: Event::BlockedHost
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
32
|
+
const :source, Source::Security, default: Source::Security, override: true
|
|
33
|
+
const :event, Event, default: Event::BlockedHost, override: true
|
|
34
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
35
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
36
|
|
|
32
|
-
const :path, T.nilable(String), default: nil
|
|
33
|
-
const :http_method, T.nilable(String), default: nil
|
|
34
|
-
const :source_ip, T.nilable(String), default: nil
|
|
35
|
-
const :user_agent, T.nilable(String), default: nil
|
|
36
|
-
const :referer, T.nilable(String), default: nil
|
|
37
|
+
const :path, T.nilable(String), default: nil, override: true
|
|
38
|
+
const :http_method, T.nilable(String), default: nil, override: true
|
|
39
|
+
const :source_ip, T.nilable(String), default: nil, override: true
|
|
40
|
+
const :user_agent, T.nilable(String), default: nil, override: true
|
|
41
|
+
const :referer, T.nilable(String), default: nil, override: true
|
|
37
42
|
|
|
38
43
|
# Event-specific fields
|
|
39
44
|
const :message, T.nilable(String), default: nil
|
|
@@ -42,8 +47,7 @@ module LogStruct
|
|
|
42
47
|
const :x_forwarded_for, T.nilable(String), default: nil
|
|
43
48
|
|
|
44
49
|
# Additional data
|
|
45
|
-
|
|
46
|
-
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
|
|
47
51
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
48
52
|
|
|
49
53
|
FIELD_KEYS = T.let(
|
|
@@ -56,11 +60,7 @@ module LogStruct
|
|
|
56
60
|
FIELD_KEYS
|
|
57
61
|
end
|
|
58
62
|
|
|
59
|
-
# Request fields (optional)
|
|
60
|
-
include LogStruct::Log::Interfaces::RequestFields
|
|
61
|
-
|
|
62
63
|
# Serialize shared fields
|
|
63
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
64
64
|
include LogStruct::Log::Shared::SerializeCommon
|
|
65
65
|
include LogStruct::Log::Shared::AddRequestFields
|
|
66
66
|
|
|
@@ -23,24 +23,28 @@ module LogStruct
|
|
|
23
23
|
class CSRFViolation < 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
|
+
include LogStruct::Log::Interfaces::RequestFields
|
|
30
|
+
|
|
26
31
|
# Shared/common fields
|
|
27
|
-
const :source, Source::Security, default: Source::Security
|
|
28
|
-
const :event, Event, default: Event::CSRFViolation
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
32
|
+
const :source, Source::Security, default: Source::Security, override: true
|
|
33
|
+
const :event, Event, default: Event::CSRFViolation, override: true
|
|
34
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
35
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
36
|
|
|
32
|
-
const :path, T.nilable(String), default: nil
|
|
33
|
-
const :http_method, T.nilable(String), default: nil
|
|
34
|
-
const :source_ip, T.nilable(String), default: nil
|
|
35
|
-
const :user_agent, T.nilable(String), default: nil
|
|
36
|
-
const :referer, T.nilable(String), default: nil
|
|
37
|
+
const :path, T.nilable(String), default: nil, override: true
|
|
38
|
+
const :http_method, T.nilable(String), default: nil, override: true
|
|
39
|
+
const :source_ip, T.nilable(String), default: nil, override: true
|
|
40
|
+
const :user_agent, T.nilable(String), default: nil, override: true
|
|
41
|
+
const :referer, T.nilable(String), default: nil, override: true
|
|
37
42
|
|
|
38
43
|
# Event-specific fields
|
|
39
44
|
const :message, T.nilable(String), default: nil
|
|
40
45
|
|
|
41
46
|
# Additional data
|
|
42
|
-
|
|
43
|
-
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
|
|
47
|
+
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
|
|
44
48
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
45
49
|
|
|
46
50
|
FIELD_KEYS = T.let(
|
|
@@ -53,11 +57,7 @@ module LogStruct
|
|
|
53
57
|
FIELD_KEYS
|
|
54
58
|
end
|
|
55
59
|
|
|
56
|
-
# Request fields (optional)
|
|
57
|
-
include LogStruct::Log::Interfaces::RequestFields
|
|
58
|
-
|
|
59
60
|
# Serialize shared fields
|
|
60
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
61
61
|
include LogStruct::Log::Shared::SerializeCommon
|
|
62
62
|
include LogStruct::Log::Shared::AddRequestFields
|
|
63
63
|
|
|
@@ -23,17 +23,22 @@ module LogStruct
|
|
|
23
23
|
class IPSpoof < 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
|
+
include LogStruct::Log::Interfaces::RequestFields
|
|
30
|
+
|
|
26
31
|
# Shared/common fields
|
|
27
|
-
const :source, Source::Security, default: Source::Security
|
|
28
|
-
const :event, Event, default: Event::IPSpoof
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
32
|
+
const :source, Source::Security, default: Source::Security, override: true
|
|
33
|
+
const :event, Event, default: Event::IPSpoof, override: true
|
|
34
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
35
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
36
|
|
|
32
|
-
const :path, T.nilable(String), default: nil
|
|
33
|
-
const :http_method, T.nilable(String), default: nil
|
|
34
|
-
const :source_ip, T.nilable(String), default: nil
|
|
35
|
-
const :user_agent, T.nilable(String), default: nil
|
|
36
|
-
const :referer, T.nilable(String), default: nil
|
|
37
|
+
const :path, T.nilable(String), default: nil, override: true
|
|
38
|
+
const :http_method, T.nilable(String), default: nil, override: true
|
|
39
|
+
const :source_ip, T.nilable(String), default: nil, override: true
|
|
40
|
+
const :user_agent, T.nilable(String), default: nil, override: true
|
|
41
|
+
const :referer, T.nilable(String), default: nil, override: true
|
|
37
42
|
|
|
38
43
|
# Event-specific fields
|
|
39
44
|
const :message, T.nilable(String), default: nil
|
|
@@ -41,8 +46,7 @@ module LogStruct
|
|
|
41
46
|
const :x_forwarded_for, T.nilable(String), default: nil
|
|
42
47
|
|
|
43
48
|
# Additional data
|
|
44
|
-
|
|
45
|
-
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
|
|
49
|
+
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
|
|
46
50
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
47
51
|
|
|
48
52
|
FIELD_KEYS = T.let(
|
|
@@ -55,11 +59,7 @@ module LogStruct
|
|
|
55
59
|
FIELD_KEYS
|
|
56
60
|
end
|
|
57
61
|
|
|
58
|
-
# Request fields (optional)
|
|
59
|
-
include LogStruct::Log::Interfaces::RequestFields
|
|
60
|
-
|
|
61
62
|
# Serialize shared fields
|
|
62
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
63
63
|
include LogStruct::Log::Shared::SerializeCommon
|
|
64
64
|
include LogStruct::Log::Shared::AddRequestFields
|
|
65
65
|
|
|
@@ -23,18 +23,20 @@ module LogStruct
|
|
|
23
23
|
class Delete < 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::Shrine, default: Source::Shrine
|
|
28
|
-
const :event, Event, default: Event::Delete
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::Shrine, default: Source::Shrine, override: true
|
|
31
|
+
const :event, Event, default: Event::Delete, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
34
|
|
|
32
35
|
# Event-specific fields
|
|
33
36
|
const :storage, Symbol
|
|
34
37
|
const :location, String
|
|
35
38
|
|
|
36
39
|
# Serialize shared fields
|
|
37
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
38
40
|
include LogStruct::Log::Shared::SerializeCommon
|
|
39
41
|
|
|
40
42
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
|
@@ -23,11 +23,14 @@ module LogStruct
|
|
|
23
23
|
class Download < 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::Shrine, default: Source::Shrine
|
|
28
|
-
const :event, Event, default: Event::Download
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::Shrine, default: Source::Shrine, override: true
|
|
31
|
+
const :event, Event, default: Event::Download, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
34
|
|
|
32
35
|
# Event-specific fields
|
|
33
36
|
const :storage, Symbol
|
|
@@ -35,7 +38,6 @@ module LogStruct
|
|
|
35
38
|
const :download_options, T.nilable(T::Hash[Symbol, T.untyped]), default: nil
|
|
36
39
|
|
|
37
40
|
# Serialize shared fields
|
|
38
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
39
41
|
include LogStruct::Log::Shared::SerializeCommon
|
|
40
42
|
|
|
41
43
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
|
@@ -23,18 +23,20 @@ module LogStruct
|
|
|
23
23
|
class Exist < 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::Shrine, default: Source::Shrine
|
|
28
|
-
const :event, Event, default: Event::Exist
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::Shrine, default: Source::Shrine, override: true
|
|
31
|
+
const :event, Event, default: Event::Exist, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
34
|
|
|
32
35
|
# Event-specific fields
|
|
33
36
|
const :storage, Symbol
|
|
34
37
|
const :location, String
|
|
35
38
|
|
|
36
39
|
# Serialize shared fields
|
|
37
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
38
40
|
include LogStruct::Log::Shared::SerializeCommon
|
|
39
41
|
|
|
40
42
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
|
@@ -23,18 +23,20 @@ module LogStruct
|
|
|
23
23
|
class Metadata < 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::Shrine, default: Source::Shrine
|
|
28
|
-
const :event, Event, default: Event::Metadata
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::Shrine, default: Source::Shrine, override: true
|
|
31
|
+
const :event, Event, default: Event::Metadata, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
34
|
|
|
32
35
|
# Event-specific fields
|
|
33
36
|
const :storage, Symbol
|
|
34
37
|
const :duration_ms, T.nilable(Float), default: nil
|
|
35
38
|
|
|
36
39
|
# Serialize shared fields
|
|
37
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
38
40
|
include LogStruct::Log::Shared::SerializeCommon
|
|
39
41
|
|
|
40
42
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
|
@@ -23,11 +23,14 @@ module LogStruct
|
|
|
23
23
|
class Upload < 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::Shrine, default: Source::Shrine
|
|
28
|
-
const :event, Event, default: Event::Upload
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::Shrine, default: Source::Shrine, override: true
|
|
31
|
+
const :event, Event, default: Event::Upload, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
34
|
|
|
32
35
|
# Event-specific fields
|
|
33
36
|
const :storage, Symbol
|
|
@@ -40,7 +43,6 @@ module LogStruct
|
|
|
40
43
|
const :duration_ms, T.nilable(Float), default: nil
|
|
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,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::Sidekiq, default: Source::Sidekiq
|
|
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::Sidekiq, default: Source::Sidekiq, 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
|
# Event-specific fields
|
|
33
37
|
const :error_class, T.class_of(Exception)
|
|
@@ -38,8 +42,7 @@ module LogStruct
|
|
|
38
42
|
const :retry_count, T.nilable(Integer), default: nil
|
|
39
43
|
|
|
40
44
|
# Additional data
|
|
41
|
-
|
|
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 Log < 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::Sidekiq, default: Source::Sidekiq
|
|
28
|
-
const :event, Event, default: Event::Log
|
|
29
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
30
|
-
const :level, Level, default: Level::Info
|
|
31
|
+
const :source, Source::Sidekiq, default: Source::Sidekiq, override: true
|
|
32
|
+
const :event, Event, default: Event::Log, override: true
|
|
33
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
34
|
+
const :level, Level, default: Level::Info, override: true
|
|
31
35
|
|
|
32
36
|
# Event-specific fields
|
|
33
37
|
const :message, T.nilable(String), default: nil
|
|
@@ -36,8 +40,7 @@ module LogStruct
|
|
|
36
40
|
const :thread_id, T.nilable(T.any(Integer, String)), default: nil
|
|
37
41
|
|
|
38
42
|
# Additional data
|
|
39
|
-
|
|
40
|
-
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil
|
|
43
|
+
const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true
|
|
41
44
|
include LogStruct::Log::Shared::MergeAdditionalDataFields
|
|
42
45
|
|
|
43
46
|
FIELD_KEYS = T.let(
|
|
@@ -51,7 +54,6 @@ module LogStruct
|
|
|
51
54
|
end
|
|
52
55
|
|
|
53
56
|
# Serialize shared fields
|
|
54
|
-
include LogStruct::Log::Interfaces::CommonFields
|
|
55
57
|
include LogStruct::Log::Shared::SerializeCommon
|
|
56
58
|
|
|
57
59
|
sig { returns(T::Hash[LogStruct::LogField, T.untyped]) }
|
data/lib/log_struct/log/sql.rb
CHANGED
|
@@ -22,11 +22,15 @@ module LogStruct
|
|
|
22
22
|
class SQL < T::Struct
|
|
23
23
|
extend T::Sig
|
|
24
24
|
|
|
25
|
+
# A prop marked `override` needs the method it implements to exist already
|
|
26
|
+
include LogStruct::Log::Interfaces::CommonFields
|
|
27
|
+
include LogStruct::Log::Interfaces::AdditionalDataField
|
|
28
|
+
|
|
25
29
|
# Shared/common fields
|
|
26
|
-
const :source, Source::App, default: Source::App
|
|
27
|
-
const :event, Event, default: Event::Database
|
|
28
|
-
const :timestamp, Time, factory: -> { Time.now }
|
|
29
|
-
const :level, Level, default: Level::Info
|
|
30
|
+
const :source, Source::App, default: Source::App, override: true
|
|
31
|
+
const :event, Event, default: Event::Database, override: true
|
|
32
|
+
const :timestamp, Time, factory: -> { Time.now }, override: true
|
|
33
|
+
const :level, Level, default: Level::Info, override: true
|
|
30
34
|
|
|
31
35
|
# Event-specific fields
|
|
32
36
|
const :message, String
|
|
@@ -43,8 +47,7 @@ module LogStruct
|
|
|
43
47
|
const :table_names, T.nilable(T::Array[String]), default: nil
|
|
44
48
|
|
|
45
49
|
# Additional data
|
|
46
|
-
|
|
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]) }
|
|
@@ -24,6 +24,7 @@ module ActiveSupport
|
|
|
24
24
|
module FormatterExtension
|
|
25
25
|
extend T::Sig
|
|
26
26
|
extend T::Helpers
|
|
27
|
+
|
|
27
28
|
requires_ancestor { ::ActiveSupport::TaggedLogging::Formatter }
|
|
28
29
|
|
|
29
30
|
sig { params(severity: T.any(String, Symbol), time: Time, progname: T.untyped, data: T.untyped).returns(String) }
|
|
@@ -67,7 +67,7 @@ module LogStruct
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# Set the reporter to use (user-friendly API that accepts symbols)
|
|
70
|
-
sig { params(reporter_type: T.any(ErrorReporter, Symbol, Handlers::ErrorReporter)).
|
|
70
|
+
sig { params(reporter_type: T.any(ErrorReporter, Symbol, Handlers::ErrorReporter)).void }
|
|
71
71
|
def reporter=(reporter_type)
|
|
72
72
|
@reporter_impl = case reporter_type
|
|
73
73
|
when ErrorReporter
|
|
@@ -10,16 +10,13 @@ module LogStruct
|
|
|
10
10
|
extend T::Sig
|
|
11
11
|
|
|
12
12
|
# Matched by name, so this works without ActionDispatch or Rack loaded
|
|
13
|
-
NAMES =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
].freeze,
|
|
21
|
-
T::Array[String]
|
|
22
|
-
)
|
|
13
|
+
NAMES = [
|
|
14
|
+
"ActionDispatch::Http::Parameters::ParseError",
|
|
15
|
+
"Rack::BadRequest",
|
|
16
|
+
"Rack::QueryParser::InvalidParameterError",
|
|
17
|
+
"Rack::QueryParser::ParameterTypeError",
|
|
18
|
+
"Rack::QueryParser::ParamsTooDeepError"
|
|
19
|
+
].freeze
|
|
23
20
|
# Rails' message for a ParseError
|
|
24
21
|
PARSE_ERROR_MESSAGE = "Error occurred while parsing request parameters"
|
|
25
22
|
PARAMS_ERROR_MESSAGE = "Invalid request parameters"
|
|
@@ -97,7 +97,7 @@ module LogStruct
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
# A logged Hash may set its own src and evt, but the line's timestamp and level come from the logger
|
|
100
|
-
HASH_RESERVED_KEYS =
|
|
100
|
+
HASH_RESERVED_KEYS = %w[ts lvl].freeze
|
|
101
101
|
|
|
102
102
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T::Hash[T.untyped, T.untyped]) }
|
|
103
103
|
def without_reserved_keys(hash)
|
|
@@ -26,7 +26,7 @@ module LogStruct
|
|
|
26
26
|
class Logger < ::SemanticLogger::Logger
|
|
27
27
|
extend T::Sig
|
|
28
28
|
|
|
29
|
-
sig { params(name: T.any(String, Symbol,
|
|
29
|
+
sig { params(name: T.any(String, Symbol, T::Module[T.anything]), level: T.nilable(Symbol), filter: T.untyped).void }
|
|
30
30
|
def initialize(name = "Application", level: nil, filter: nil)
|
|
31
31
|
# SemanticLogger::Logger expects positional arguments, not named arguments
|
|
32
32
|
super(name, level, filter)
|
|
@@ -18,10 +18,7 @@ module LogStruct
|
|
|
18
18
|
extend T::Sig
|
|
19
19
|
|
|
20
20
|
# Load hooks for the framework components whose loggers LogStruct replaces
|
|
21
|
-
COMPONENT_LOAD_HOOKS =
|
|
22
|
-
%i[active_record action_controller action_mailer active_job action_view action_cable].freeze,
|
|
23
|
-
T::Array[Symbol]
|
|
24
|
-
)
|
|
21
|
+
COMPONENT_LOAD_HOOKS = %i[active_record action_controller action_mailer active_job action_view action_cable].freeze
|
|
25
22
|
|
|
26
23
|
# The logger LogStruct installed, and the loggers it replaced
|
|
27
24
|
@logger = T.let(nil, T.nilable(LogStruct::SemanticLogger::Logger))
|
|
@@ -36,7 +36,7 @@ module LogStruct
|
|
|
36
36
|
# A URL's query string, for the sensitive params in it
|
|
37
37
|
QUERY_STRING_REGEX = /\?([^\s#"'<>]+)/
|
|
38
38
|
# OAuth authorization codes, which no key pattern would filter
|
|
39
|
-
SENSITIVE_QUERY_PARAMS =
|
|
39
|
+
SENSITIVE_QUERY_PARAMS = ["code"].freeze
|
|
40
40
|
QUERY_PARAM_REPLACEMENT = "[FILTERED]"
|
|
41
41
|
|
|
42
42
|
# Letters and digits of any script (an accented name, a domain in another alphabet)
|
data/lib/log_struct/version.rb
CHANGED
data/logstruct.gemspec
CHANGED
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
|
45
45
|
spec.add_dependency "lograge", ">= 0.11"
|
|
46
46
|
spec.add_dependency "railties", ">= 7.1"
|
|
47
47
|
spec.add_dependency "semantic_logger", "~> 4.15"
|
|
48
|
-
spec.add_dependency "sorbet-runtime", ">= 0.
|
|
48
|
+
spec.add_dependency "sorbet-runtime", ">= 0.6.12698"
|
|
49
49
|
|
|
50
50
|
# Optional integrations
|
|
51
51
|
spec.add_development_dependency "bugsnag", "~> 6.26"
|