Module: ActiveJob::Temporal::Logger
Overview
SemanticLogger Detection If the configured logger is a SemanticLogger instance, log entries are passed directly as hashes. Otherwise, the module JSON-stringifies the payload before passing it to the configured Ruby Logger instance.
Structured logging for activejob-temporal gem.
This module provides structured JSON logging with event names and typed attributes. It integrates with SemanticLogger if available, otherwise falls back to standard Ruby Logger with JSON formatting.
All log entries include:
-
event: Event name (String or Symbol)
-
timestamp: ISO8601 UTC timestamp
-
Custom attributes (Hash)
Constant Summary collapse
- CONTROL_CHARACTER_PATTERN =
/[[:cntrl:]]/
Instance Method Summary collapse
-
#error(event_name, attributes = {}) ⇒ void
Logs an event at ERROR level.
-
#info(event_name, attributes = {}) ⇒ void
Logs an event at INFO level.
-
#log_event(event_name, attributes = {}) ⇒ void
Logs an event at INFO level.
- #log_to(configured_logger, level, event_name, attributes = {}) ⇒ Object
-
#warn(event_name, attributes = {}) ⇒ void
Logs an event at WARN level.
Instance Method Details
#error(event_name, attributes = {}) ⇒ void
This method returns an undefined value.
Logs an event at ERROR level.
104 105 106 |
# File 'lib/activejob/temporal/logger.rb', line 104 def error(event_name, attributes = {}) log(:error, event_name, attributes) end |
#info(event_name, attributes = {}) ⇒ void
This method returns an undefined value.
Logs an event at INFO level.
76 77 78 |
# File 'lib/activejob/temporal/logger.rb', line 76 def info(event_name, attributes = {}) log(:info, event_name, attributes) end |
#log_event(event_name, attributes = {}) ⇒ void
This method returns an undefined value.
Logs an event at INFO level.
62 63 64 |
# File 'lib/activejob/temporal/logger.rb', line 62 def log_event(event_name, attributes = {}) log(:info, event_name, attributes) end |
#log_to(configured_logger, level, event_name, attributes = {}) ⇒ Object
108 109 110 |
# File 'lib/activejob/temporal/logger.rb', line 108 def log_to(configured_logger, level, event_name, attributes = {}) log(level, event_name, attributes, configured_logger: configured_logger) end |
#warn(event_name, attributes = {}) ⇒ void
This method returns an undefined value.
Logs an event at WARN level.
90 91 92 |
# File 'lib/activejob/temporal/logger.rb', line 90 def warn(event_name, attributes = {}) log(:warn, event_name, attributes) end |