Class: CoreLibrary::EndpointLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/apimatic-core/logger/endpoint_logger.rb

Overview

This class is responsible for logging info messages, debug messages, and errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ EndpointLogger

Returns a new instance of EndpointLogger.



6
7
8
# File 'lib/apimatic-core/logger/endpoint_logger.rb', line 6

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/apimatic-core/logger/endpoint_logger.rb', line 4

def logger
  @logger
end

Instance Method Details

#debug(debug_message) ⇒ Object

Logs the debug message.

Parameters:

  • debug_message (String)

    The message to be logged.



18
19
20
# File 'lib/apimatic-core/logger/endpoint_logger.rb', line 18

def debug(debug_message)
  @logger&.debug(debug_message)
end

#error(error) ⇒ Object

Logs the error.

Parameters:

  • error (Exception)

    The exception to be logged.



24
25
26
# File 'lib/apimatic-core/logger/endpoint_logger.rb', line 24

def error(error)
  @logger&.error(error)
end

#info(info_message) ⇒ Object

Logs the info message.

Parameters:

  • info_message (String)

    The message to be logged.



12
13
14
# File 'lib/apimatic-core/logger/endpoint_logger.rb', line 12

def info(info_message)
  @logger&.info(info_message)
end