lib/semantic_logger/metric/statsd.rb in semantic_logger-4.2.0 vs lib/semantic_logger/metric/statsd.rb in semantic_logger-4.2.1

- old
+ new

@@ -39,15 +39,15 @@ @statsd.namespace = path.sub('/', '') if path != '' end def log(log) metric = log.metric - if duration = log.duration + if (duration = log.duration) @statsd.timing(metric, duration) else amount = (log.metric_amount || 1).round - if amount < 0 + if amount.negative? amount.times { @statsd.decrement(metric) } else amount.times { @statsd.increment(metric) } end end @@ -56,9 +56,8 @@ # Only forward log entries that contain metrics. def should_log?(log) # Does not support metrics with dimensions. log.metric && !log.dimensions && meets_log_level?(log) && !filtered?(log) end - end end end