Sha256: 2bf08c6901adafc9159b10e25a062993bd0b31d33ac943af2f3ce09a825bd0f8
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
# # File 'consolelog.rb' created on 23 feb 2008 at 16:39:59. # # See 'dokkit.rb' or +LICENSE+ for licence information. # # (C) 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). # require 'dokkit/logger' module Dokkit module Log class ConsoleLog class << self def consolelog @consolelog ||= ConsoleLog.new(Logger.logger) @consolelog.logger end end attr_reader :logger def initialize(logger) @logger = logger logger.attach(self) end def update message = @logger.last_message case message[:level] when Log::ERROR fail "[#{Time.now.asctime}][ERROR] #{message[:text]}" when Log::WARNING warn "[#{Time.now.asctime}][WARNING] #{message[:text]}" when Log::INFO puts "[#{Time.now.asctime}][INFO] #{message[:text]}" when Log::DEBUG puts "[#{Time.now.asctime}][DEBUG] #{message[:text]}" end message end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dokkit-0.3.0 | lib/dokkit/consolelog.rb |