Sha256: d0c4c5119f6e52db2d8c334a0431ac8d990b663559071f99bca2c6bd30c181d6
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
# encoding: utf-8 require 'logger' require 'logme/configuration' require 'logme/http_formatter' module LogMe attr_writer :log_enabled attr_writer :log_level attr_writer :log_label attr_writer :logger def log_enabled? @log_enabled != false end def log_level @log_level ||= :info end def log_label @log_label ||= self.name end def logger @logger ||= ::Logger.new(STDOUT) end def log(message) logger.send(log_level, "[#{log_label}] #{message}") 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::HttpFormatter.new end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
log-me-0.0.10 | lib/log-me.rb |
log-me-0.0.9 | lib/log-me.rb |