lib/rhcf/timeseries/redis.rb in rhcf-timeseries-0.0.4 vs lib/rhcf/timeseries/redis.rb in rhcf-timeseries-0.0.5
- old
+ new
@@ -31,10 +31,21 @@
alias_method :second, :seconds
alias_method :minute, :minutes
alias_method :year, :years
end
+class NilLogger
+ def log(*args)
+
+ end
+
+ alias_method :warn, :log
+ alias_method :debug, :log
+ alias_method :info, :log
+ alias_method :error, :log
+end
+
module Rhcf
module Timeseries
class Result
def initialize(subject, from, to, series)
@@ -124,10 +135,10 @@
attr_reader :logger
def initialize(logger, redis, options = {})
@resolution_ids = options[:resolutions] || DEFAULT_RESOLUTIONS
@prefix = options[:prefix] || self.class.name
- @logger = logger
+ @logger = logger || NilLogger.new
@connection_to_use = redis
end
def on_connection(conn)
old_connection = @connection_to_use