Class: Ant::Server::CuteLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/ant/server/logger.rb

Instance Method Summary collapse

Instance Method Details

#access(response) ⇒ Object



13
14
15
# File 'lib/ant/server/logger.rb', line 13

def access(response)
  log_info('Requesting resource', access_data(response))
end

#access_data(response) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/ant/server/logger.rb', line 5

def access_data(response)
  {
    path: response.path,
    ip: response.ip,
    verb: response.verb
  }
end

#error(response) ⇒ Object



27
28
29
30
31
# File 'lib/ant/server/logger.rb', line 27

def error(response)
  log_warn('Error dectected on response', access_data(response).merge(
                                            error: response.exception
  ))
end

#fail(response) ⇒ Object



21
22
23
24
25
# File 'lib/ant/server/logger.rb', line 21

def fail(response)
  log_info('Fail Response',
           access_data(response)
            .merge(message: response.exception.message))
end

#fatal(response) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/ant/server/logger.rb', line 33

def fatal(response)
  log_error('Unexpected error on response',
            access_data(response).merge(
              error: response.exception,
              data: response.params
            ))
end

#success(response) ⇒ Object



17
18
19
# File 'lib/ant/server/logger.rb', line 17

def success(response)
  log_info('Success request', access_data(response))
end