Module: Aoororachain::Util

Defined in:
lib/aoororachain/util.rb

Class Method Summary collapse

Class Method Details

.log_debug(message, data = {}) ⇒ Object

Logs a debug message with the given data using the provided Logger instance.

message - A String message to be logged. data - A Hash of additional data to be included in the log entry.

Examples

Util.log_debug("Debugging information", { user_id: 123, action: "update" })

Returns nothing.



34
35
36
37
38
39
40
41
# File 'lib/aoororachain/util.rb', line 34

def self.log_debug(message, data = {})
  config = data.delete(:config) || Aoororachain.config
  logger = config.logger || Aoororachain.logger

  if (!logger.nil? || !config.log_level.nil?) && config.log_level <= Aoororachain::LEVEL_DEBUG
    log_internal(message, data, level: Aoororachain::LEVEL_DEBUG, logger: Aoororachain.logger)
  end
end

.log_error(message, data = {}) ⇒ Object

Logs an error message with the given data using the provided Logger instance.

message - A String message to be logged. data - A Hash of additional data to be included in the log entry.

Examples

Util.log_error("An error occurred", { user_id: 123, error_code: "404" })

Returns nothing.



15
16
17
18
19
20
21
22
# File 'lib/aoororachain/util.rb', line 15

def self.log_error(message, data = {})
  config = data.delete(:config) || Aoororachain.config
  logger = config.logger || Aoororachain.logger

  if (!logger.nil? || !config.log_level.nil?) && config.log_level <= Aoororachain::LEVEL_ERROR
    log_internal(message, data, level: Aoororachain::LEVEL_ERROR, logger: Aoororachain.logger)
  end
end

.log_info(message, data = {}) ⇒ Object

Logs an informational message with the given data using the provided Logger instance.

message - A String message to be logged. data - A Hash of additional data to be included in the log entry.

Examples

Util.log_info("Processing request", { request_id: "abc123", route: "/users" })

Returns nothing.



53
54
55
56
57
58
59
60
# File 'lib/aoororachain/util.rb', line 53

def self.log_info(message, data = {})
  config = data.delete(:config) || Aoororachain.config
  logger = config.logger || Aoororachain.logger

  if (!logger.nil? || !config.log_level.nil?) && config.log_level <= Aoororachain::LEVEL_INFO
    log_internal(message, data, level: Aoororachain::LEVEL_INFO, logger: Aoororachain.logger)
  end
end