class Ey::Logger

Constants

VERSION

Attributes

default_level[R]
device[R]
formatter[R]
prefix[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/ey/logger.rb, line 13
def initialize(options={})
  @device        = options.fetch(:device)
  @default_level = options[:default_level]  || :info
  @prefix        = options[:prefix] || nil
  @formatter     = Ey::Logger::Formatter.for(options[:format] || :human).new(prefix)
end

Public Instance Methods

call(options) click to toggle source
# File lib/ey/logger.rb, line 20
def call(options)
  level = options[:level] || default_level
  output = formatter.call(options.fetch(:tag), options.fetch(:data))

  device.public_send(level, output)
end