lib/log-me.rb in log-me-0.0.5 vs lib/log-me.rb in log-me-0.0.6
- old
+ new
@@ -1,7 +1,8 @@
require 'logger'
require 'logme/configuration'
+require 'logme/net_http_formatter'
module LogMe
attr_writer :log_enabled
attr_writer :log_level
attr_writer :log_label
@@ -25,9 +26,23 @@
def log(message)
logger.send log_level, "[#{log_label}] #{message}\n" if log_enabled?
end
+ def log_request(request, url)
+ log formatter.format_request(request, url)
+ end
+
+ def log_response(response)
+ log formatter.format_response(response)
+ end
+
def self.extended(base)
base.send :extend, LogMe::Configuration
+ end
+
+ private
+
+ def formatter
+ @formatter ||= LogMe::NetHttpFormatter.new
end
end