Module: Appom::Logging
- Included in:
- Appom, Appom, Configuration::Config, ElementCache::Cache, ElementContainer, ElementFinder, ElementState::Tracker, Performance::Monitor, Screenshot::ScreenshotComparison, Screenshot::ScreenshotManager, Visual::TestHelpers, Wait
- Defined in:
- lib/appom/logging.rb
Overview
Logging functionality for Appom automation framework Provides centralized logging with configurable levels and formatters
Class Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #log_debug(message, context = {}) ⇒ Object
- #log_element_action(action, element_info, duration = nil) ⇒ Object
- #log_error(message, context = {}) ⇒ Object
- #log_info(message, context = {}) ⇒ Object
- #log_wait_end(condition, duration, success: true) ⇒ Object
- #log_wait_start(condition, timeout) ⇒ Object
- #log_warn(message, context = {}) ⇒ Object
-
#logger ⇒ Object
Instance methods for including in classes.
Class Attribute Details
.logger ⇒ Object
13 14 15 |
# File 'lib/appom/logging.rb', line 13 def logger @logger ||= create_default_logger end |
Class Method Details
.level ⇒ Object
21 22 23 |
# File 'lib/appom/logging.rb', line 21 def level logger.level end |
.level=(level) ⇒ Object
17 18 19 |
# File 'lib/appom/logging.rb', line 17 def level=(level) logger.level = level end |
Instance Method Details
#log_debug(message, context = {}) ⇒ Object
44 45 46 |
# File 'lib/appom/logging.rb', line 44 def log_debug(, context = {}) logger.debug((, context)) end |
#log_element_action(action, element_info, duration = nil) ⇒ Object
60 61 62 63 64 |
# File 'lib/appom/logging.rb', line 60 def log_element_action(action, element_info, duration = nil) = "#{action.upcase}: #{element_info}" += " (#{duration}ms)" if duration log_info() end |
#log_error(message, context = {}) ⇒ Object
56 57 58 |
# File 'lib/appom/logging.rb', line 56 def log_error(, context = {}) logger.error((, context)) end |
#log_info(message, context = {}) ⇒ Object
48 49 50 |
# File 'lib/appom/logging.rb', line 48 def log_info(, context = {}) logger.info((, context)) end |
#log_wait_end(condition, duration, success: true) ⇒ Object
70 71 72 73 |
# File 'lib/appom/logging.rb', line 70 def log_wait_end(condition, duration, success: true) status = success ? 'SUCCESS' : 'TIMEOUT' log_debug("WAIT: #{status} for '#{condition}' (#{duration}s)") end |
#log_wait_start(condition, timeout) ⇒ Object
66 67 68 |
# File 'lib/appom/logging.rb', line 66 def log_wait_start(condition, timeout) log_debug("WAIT: Starting wait for '#{condition}' (timeout: #{timeout}s)") end |
#log_warn(message, context = {}) ⇒ Object
52 53 54 |
# File 'lib/appom/logging.rb', line 52 def log_warn(, context = {}) logger.warn((, context)) end |
#logger ⇒ Object
Instance methods for including in classes
40 41 42 |
# File 'lib/appom/logging.rb', line 40 def logger Logging.logger end |