lib/log-me.rb in log-me-0.0.8 vs lib/log-me.rb in log-me-0.0.9
- old
+ new
@@ -1,8 +1,9 @@
+# encoding: utf-8
require 'logger'
require 'logme/configuration'
-require 'logme/net_http_formatter'
+require 'logme/http_formatter'
module LogMe
attr_writer :log_enabled
attr_writer :log_level
attr_writer :log_label
@@ -19,15 +20,15 @@
def log_label
@log_label ||= self.name
end
def logger
- @logger ||= ::Logger.new STDOUT
+ @logger ||= ::Logger.new(STDOUT)
end
def log(message)
- logger.send log_level, "[#{log_label}] #{message}\n" if log_enabled?
+ logger.send(log_level, "[#{log_label}] #{message}") if log_enabled?
end
def log_request(request, url)
log formatter.format_request(request, url)
end
@@ -35,14 +36,14 @@
def log_response(response)
log formatter.format_response(response)
end
def self.extended(base)
- base.send :extend, LogMe::Configuration
+ base.send(:extend, LogMe::Configuration)
end
private
def formatter
- @formatter ||= LogMe::NetHttpFormatter.new
+ @formatter ||= LogMe::HttpFormatter.new
end
end