Module: Dbwatcher::Logging
- Extended by:
- ActiveSupport::Concern
- Included in:
- Services::BaseService, Services::DashboardDataAggregator, Services::DiagramGenerator, Services::DiagramStrategies::BaseDiagramStrategy, Services::DiagramSystem, Services::MermaidSyntax::BaseBuilder, Services::MermaidSyntaxBuilder, Services::QueryFilterProcessor, Services::SystemInfo::DatabaseInfoCollector, Services::SystemInfo::MachineInfoCollector, Services::SystemInfo::RuntimeInfoCollector, Services::SystemInfo::SystemInfoCollector, Services::TableStatisticsCollector, Storage::SystemInfoStorage
- Defined in:
- lib/dbwatcher/logging.rb
Overview
Logging module for DBWatcher components Provides consistent logging interface across all services and components
Instance Method Summary collapse
-
#debug_enabled? ⇒ Boolean
Check if debug logging is enabled.
-
#log_debug(message, context = {}) ⇒ Object
Log a debug message with optional context Only logs if debug mode is enabled.
-
#log_error(message, context = {}) ⇒ Object
Log an error message with optional context.
-
#log_info(message, context = {}) ⇒ Object
Log an informational message with optional context.
-
#log_warn(message, context = {}) ⇒ Object
Log a warning message with optional context.
Instance Method Details
#debug_enabled? ⇒ Boolean
Check if debug logging is enabled
42 43 44 45 46 47 48 |
# File 'lib/dbwatcher/logging.rb', line 42 def debug_enabled? return Dbwatcher.configuration.debug_mode if defined?(Dbwatcher.configuration) && Dbwatcher.configuration.respond_to?(:debug_mode) return Rails.env.development? if defined?(Rails) false end |
#log_debug(message, context = {}) ⇒ Object
Log a debug message with optional context Only logs if debug mode is enabled
20 21 22 23 24 |
# File 'lib/dbwatcher/logging.rb', line 20 def log_debug(, context = {}) return unless debug_enabled? log_with_level(:debug, , context) end |
#log_error(message, context = {}) ⇒ Object
Log an error message with optional context
36 37 38 |
# File 'lib/dbwatcher/logging.rb', line 36 def log_error(, context = {}) log_with_level(:error, , context) end |
#log_info(message, context = {}) ⇒ Object
Log an informational message with optional context
12 13 14 |
# File 'lib/dbwatcher/logging.rb', line 12 def log_info(, context = {}) log_with_level(:info, , context) end |
#log_warn(message, context = {}) ⇒ Object
Log a warning message with optional context
29 30 31 |
# File 'lib/dbwatcher/logging.rb', line 29 def log_warn(, context = {}) log_with_level(:warn, , context) end |