Module: HTTParty::Logger
- Defined in:
- lib/httparty/logger/logger.rb,
lib/httparty/logger/curl_formatter.rb,
lib/httparty/logger/apache_formatter.rb,
lib/httparty/logger/logstash_formatter.rb
Defined Under Namespace
Classes: ApacheFormatter, CurlFormatter, LogstashFormatter
Class Method Summary
collapse
Class Method Details
17
18
19
20
|
# File 'lib/httparty/logger/logger.rb', line 17
def self.add_formatter(name, formatter)
raise HTTParty::Error.new("Log Formatter with name #{name} already exists") if formatters.include?(name)
formatters.merge!(name.to_sym => formatter)
end
|
.build(logger, level, formatter) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/httparty/logger/logger.rb', line 22
def self.build(logger, level, formatter)
level ||= :info
formatter ||= :apache
logger_klass = formatters[formatter] || Logger::ApacheFormatter
logger_klass.new(logger, level)
end
|