Class: OpinionatedHTTP::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Logger

Returns a new instance of Logger.



7
8
9
# File 'lib/opinionated_http/logger.rb', line 7

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/opinionated_http/logger.rb', line 5

def logger
  @logger
end

Instance Method Details

#<<(message) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/opinionated_http/logger.rb', line 11

def <<(message)
  return unless logger.trace?

  message = message.strip
  return if message.blank?

  logger.trace(message)
end

#debug(*args, &block) ⇒ Object



20
21
22
# File 'lib/opinionated_http/logger.rb', line 20

def debug(*args, &block)
  logger.trace(*args, &block)
end

#error(*args, &block) ⇒ Object



32
33
34
# File 'lib/opinionated_http/logger.rb', line 32

def error(*args, &block)
  logger.error(*args, &block)
end

#info(*args, &block) ⇒ Object



24
25
26
# File 'lib/opinionated_http/logger.rb', line 24

def info(*args, &block)
  logger.info(*args, &block)
end

#warn(*args, &block) ⇒ Object



28
29
30
# File 'lib/opinionated_http/logger.rb', line 28

def warn(*args, &block)
  logger.warn(*args, &block)
end