class Gemstash::Logging::StreamLogger

Logger that looks like a stream, for Puma and Rack to log to.

Public Class Methods

for_stderr() click to toggle source
# File lib/gemstash/logging.rb, line 80
def self.for_stderr
  new(Logger::ERROR)
end
for_stdout() click to toggle source
# File lib/gemstash/logging.rb, line 76
def self.for_stdout
  new(Logger::INFO)
end
new(level) click to toggle source
# File lib/gemstash/logging.rb, line 84
def initialize(level)
  @level = level
end
puma_events() click to toggle source
# File lib/gemstash/logging.rb, line 70
def self.puma_events
  # Puma 6 removed logging from Events and placed it in LogWriter
  klass = Puma.const_defined?(:LogWriter) ? Puma::LogWriter : Puma::Events
  klass.new(for_stdout, for_stderr)
end

Public Instance Methods

flush() click to toggle source
# File lib/gemstash/logging.rb, line 88
def flush; end
puts(message) click to toggle source
# File lib/gemstash/logging.rb, line 100
def puts(message)
  Gemstash::Logging.logger.add(@level, message)
end
sync() click to toggle source
# File lib/gemstash/logging.rb, line 92
def sync
  false
end
sync=(_value) click to toggle source
# File lib/gemstash/logging.rb, line 90
def sync=(_value); end
write(message) click to toggle source
# File lib/gemstash/logging.rb, line 96
def write(message)
  Gemstash::Logging.logger.add(@level, message)
end