class Thrifty::Logger::IoAppender

Public Class Methods

new(io = nil, formatter = nil) click to toggle source
# File lib/thrifty/logger/appenders/io_appender.rb, line 3
def initialize(io = nil, formatter = nil)
  @io        = io || STDOUT
  is_tty     = @io.respond_to?(:tty?) && @io.tty?
  @formatter = formatter || (is_tty ? SimpleFormatter.new : LogfmtFormatter.new)
end

Public Instance Methods

call(entry) click to toggle source
# File lib/thrifty/logger/appenders/io_appender.rb, line 9
def call(entry)
  @formatter.call(entry).each{|line| @io.puts line }
end