Class: FHTTPClient::Logger::Default

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

Overview

A Basic logger to use when no logger is provided

Instance Method Summary collapse

Constructor Details

#initialize(tags: []) ⇒ Default

Returns a new instance of Default.



7
8
9
10
# File 'lib/f_http_client/logger/default.rb', line 7

def initialize(tags: [])
  @logger = ::Logger.new($stdout)
  @current_tags = tags
end

Instance Method Details

#debug(message) ⇒ Object



17
# File 'lib/f_http_client/logger/default.rb', line 17

def debug(message) = add(::Logger::DEBUG, message)

#error(message) ⇒ Object



20
# File 'lib/f_http_client/logger/default.rb', line 20

def error(message) = add(::Logger::ERROR, message)

#fatal(message) ⇒ Object



21
# File 'lib/f_http_client/logger/default.rb', line 21

def fatal(message) = add(::Logger::FATAL, message)

#info(message) ⇒ Object



18
# File 'lib/f_http_client/logger/default.rb', line 18

def info(message) = add(::Logger::INFO, message)

#tagged(*tags) ⇒ Object



12
13
14
15
# File 'lib/f_http_client/logger/default.rb', line 12

def tagged(*tags)
  tagged = self.class.new(tags: current_tags + tags)
  block_given? ? yield(tagged) : tagged
end

#unknown(message) ⇒ Object



22
# File 'lib/f_http_client/logger/default.rb', line 22

def unknown(message) = add(::Logger::UNKNOWN, message)

#warn(message) ⇒ Object



19
# File 'lib/f_http_client/logger/default.rb', line 19

def warn(message) = add(::Logger::WARN, message)