class StatsD::Instrument::LogSink

@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.

Attributes

logger[R]
severity[R]

Public Class Methods

new(logger, severity: Logger::DEBUG) click to toggle source
# File lib/statsd/instrument/log_sink.rb, line 8
def initialize(logger, severity: Logger::DEBUG)
  @logger = logger
  @severity = severity
end

Public Instance Methods

<<(datagram) click to toggle source
# File lib/statsd/instrument/log_sink.rb, line 17
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
end
sample?(_sample_rate) click to toggle source
# File lib/statsd/instrument/log_sink.rb, line 13
def sample?(_sample_rate)
  true
end