class Ant::Server::Logger

Implements monitoring. This will add logs. Currently it only support CuteLogger format, but it will be deprecated in order to support a new log (actually kind of the same format).

Public Instance Methods

access(response) click to toggle source
# File lib/ant/server/logger.rb, line 21
def access(response)
  log_info('Requesting resource', access_data(response))
end
access_data(response) click to toggle source
# File lib/ant/server/logger.rb, line 11
def access_data(response)
  {
    path: response.path,
    ip: response.ip,
    verb: response.verb,
    processing_time:
      (Time.now - response.params[:__init_time]).to_f * 1000
  }
end
error(response) click to toggle source
# File lib/ant/server/logger.rb, line 35
def error(response)
  log_warn('Error dectected on response', access_data(response).merge(
                                            error: response.exception
                                          ))
end
fail(response) click to toggle source
# File lib/ant/server/logger.rb, line 29
def fail(response)
  log_info('Fail Response',
           access_data(response)
            .merge(message: response.exception.message))
end
fatal(response) click to toggle source
# File lib/ant/server/logger.rb, line 41
def fatal(response)
  log_error('Unexpected error on response',
            access_data(response).merge(
              error: response.exception,
              data: response.params
            ))
end
success(response) click to toggle source
# File lib/ant/server/logger.rb, line 25
def success(response)
  log_info('Success request', access_data(response))
end