Sha256: a70f72007ec3b271c03192076de60a2049ad971ec4a11bd3018fa0b1d8184bb7

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

require 'logger'
#Create a Logger that is a singleton provided by the instance method
class Log
  def self.instance(log_file = nil)
    @@instance ||= create_logger(log_file)
  end

  def self.create_logger(log_file)
    log_file = STDOUT if log_file == nil
    logger = Logger.new(log_file)
    logger.datetime_format = "%Y-%m-%d %H:%M:%S"
    logger.formatter = proc do |severity, datetime, progname, msg|
      "#{datetime}: #{msg}\n"
    end
    logger
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mogbak-0.2.1 lib/log.rb
mogbak-0.2.0 lib/log.rb