Sha256: 36e25641a9e2147672cbce3f2471f614220e82ce430b5112229ee6d11ab121f0

Contents?: true

Size: 532 Bytes

Versions: 7

Compression:

Stored size: 532 Bytes

Contents

require 'logger'

module Safubot
  # Log is a simple wrapper for stdout and file-writing Logger instances.
  module Log
    class << self
      attr_reader :path

	  # Commence logging to the specified file path.
      def path=(str)
		@path = str
        @filelog = Logger.new(str)
      end

	  # Dispatch method calls to Logger objects.
      def method_missing(method, *args)
        @stdlog ||= Logger.new(STDOUT)
        @stdlog.send(method, *args)
        @filelog.send(method, *args) if @filelog
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
safubot-0.0.9 lib/safubot/log.rb
safubot-0.0.8 lib/safubot/log.rb
safubot-0.0.7 lib/safubot/log.rb
safubot-0.0.6 lib/safubot/log.rb
safubot-0.0.5 lib/safubot/log.rb
safubot-0.0.4 lib/safubot/log.rb
safubot-0.0.3 lib/safubot/log.rb