Sha256: 8793dcf688f90955d3585c29add2cb0c0736f7db490526368029cd0350ad7510

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

# encoding: utf-8

require 'madvertise/ext/environment'
require 'madvertise-logging'

def init_logger(progname=$0, filename=nil)
  progname = File.basename(progname)
  filename ||= "#{Env.mode}.log"

  MultiLogger.new.tap do |logger|
    init_multi_logger(logger, progname, filename)
  end
end

def init_multi_logger(logger, progname=$0, filename=nil)
  if Env.dev? or Env.test?
    logger.attach(ImprovedLogger.new(STDERR, progname))
  else
    logger.attach(ImprovedLogger.new(:syslog, progname))
  end

  # default log level
  logger.level = Logger::INFO
end

$log = init_logger

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
madvertise-ext-0.4.0 lib/madvertise/ext/logging.rb
madvertise-ext-0.3.0 lib/madvertise/ext/logging.rb