lib/statsd/instrument/log_sink.rb in statsd-instrument-3.0.0 vs lib/statsd/instrument/log_sink.rb in statsd-instrument-3.0.1

- old
+ new

@@ -1,24 +1,28 @@ # frozen_string_literal: true -# @note This class is part of the new Client implementation that is intended -# to become the new default in the next major release of this library. -class StatsD::Instrument::LogSink - attr_reader :logger, :severity +module StatsD + module Instrument + # @note This class is part of the new Client implementation that is intended + # to become the new default in the next major release of this library. + class LogSink + attr_reader :logger, :severity - def initialize(logger, severity: Logger::DEBUG) - @logger = logger - @severity = severity - end + def initialize(logger, severity: Logger::DEBUG) + @logger = logger + @severity = severity + end - def sample?(_sample_rate) - true - end + def sample?(_sample_rate) + true + end - def <<(datagram) - # Some implementations require a newline at the end of datagrams. - # When logging, we make sure those newlines are removed using chomp. + def <<(datagram) + # Some implementations require a newline at the end of datagrams. + # When logging, we make sure those newlines are removed using chomp. - logger.add(severity, "[StatsD] #{datagram.chomp}") - self + logger.add(severity, "[StatsD] #{datagram.chomp}") + self + end + end end end