Class: Makit::Logging::Sinks::Structured
- Defined in:
- lib/makit/logging/sinks/structured.rb
Overview
Structured sink for adding metadata to log requests
This sink enriches log requests with structured metadata like process information, thread details, and other contextual data that can be useful for debugging and monitoring. It follows the same pattern as other sinks but focuses on data enrichment rather than output.
Instance Method Summary collapse
-
#call(log_request) {|LogRequest| ... } ⇒ LogRequest
Execute sink logic to add structured metadata.
-
#config ⇒ Hash
Get sink configuration.
-
#initialize(include_process_info: true, include_thread_info: true, include_timing: true, custom_metadata: {}) ⇒ Structured
constructor
Initialize structured sink.
Methods inherited from Base
Constructor Details
#initialize(include_process_info: true, include_thread_info: true, include_timing: true, custom_metadata: {}) ⇒ Structured
Initialize structured sink
32 33 34 35 36 37 |
# File 'lib/makit/logging/sinks/structured.rb', line 32 def initialize(include_process_info: true, include_thread_info: true, include_timing: true, custom_metadata: {}) @include_process_info = include_process_info @include_thread_info = include_thread_info @include_timing = include_timing @custom_metadata = .dup end |
Instance Method Details
#call(log_request) {|LogRequest| ... } ⇒ LogRequest
Execute sink logic to add structured metadata
45 46 47 48 49 |
# File 'lib/makit/logging/sinks/structured.rb', line 45 def call(log_request, &block) (log_request) block&.call(log_request) if block_given? log_request end |
#config ⇒ Hash
Get sink configuration
54 55 56 57 58 59 60 61 62 |
# File 'lib/makit/logging/sinks/structured.rb', line 54 def config { name: self.class.name.split("::").last, include_process_info: @include_process_info, include_thread_info: @include_thread_info, include_timing: @include_timing, custom_metadata: @custom_metadata, } end |