class S3Antivirus::Tee

Public Class Methods

new(path, options={}) click to toggle source
# File lib/s3_antivirus/tee.rb, line 7
def initialize(path, options={})
  @path, @options = path, options
end

Public Instance Methods

logger() click to toggle source
# File lib/s3_antivirus/tee.rb, line 27
def logger
  Syslog::Logger.new(@path)
end
method_missing(name, message, &block) click to toggle source
Calls superclass method
# File lib/s3_antivirus/tee.rb, line 11
def method_missing(name, message, &block)
  if logger.respond_to?(name)
    # Interesting note about level mapping: http://bit.ly/2PP5Y6Z
    #   Messages from Ruby applications are not considered as critical as messages
    #   from other system daemons using syslog(3), so most messages are reduced by one level.
    #
    # Will mimic behavior for puts stdout.
    # Interestingly, the default logger.level is ::Logger::DEBUG which is 0.
    # So can't check against that, so will check against the method name.
    puts message unless name == :debug
    logger.send(name, message, &block)
  else
    super
  end
end