Class: Minato::Utils::BaseLogger
- Inherits:
-
Object
- Object
- Minato::Utils::BaseLogger
- Defined in:
- lib/minato/utils/logger.rb
Instance Method Summary collapse
- #call(type, message) ⇒ Object
-
#initialize(logger) ⇒ BaseLogger
constructor
A new instance of BaseLogger.
- #log_request(method, host, path, options) ⇒ Object
- #log_response(method, host, path, options, response) ⇒ Object
Constructor Details
#initialize(logger) ⇒ BaseLogger
Returns a new instance of BaseLogger.
20 21 22 23 24 |
# File 'lib/minato/utils/logger.rb', line 20 def initialize(logger) @logger = logger @logger.formatter = LogFormatter.new if @logger @debug = Minato::Utils.config.debug end |
Instance Method Details
#call(type, message) ⇒ Object
43 44 45 |
# File 'lib/minato/utils/logger.rb', line 43 def call(type, ) @logger.send type, end |
#log_request(method, host, path, options) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/minato/utils/logger.rb', line 26 def log_request(method, host, path, ) return unless @logger call :info, message: "Minato::Utils::Client starting request to #{host}#{path}", http_request: request_data(method, host, path, ) end |
#log_response(method, host, path, options, response) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/minato/utils/logger.rb', line 34 def log_response(method, host, path, , response) return unless @logger call :info, message: "Minato::Utils::Client receiving response from #{host}#{path}", http_request: request_data(method, host, path, ), http_response: response_data(response) end |