Sha256: 53e8b0a3c4ffc2614aa02466affb0374a41e012babecee05f5f49dccffc71df8
Contents?: true
Size: 909 Bytes
Versions: 5
Compression:
Stored size: 909 Bytes
Contents
module Redwood class Logger @@instance = nil attr_reader :buf def initialize raise "only one Log can be defined" if @@instance @@instance = self @mode = LogMode.new @respawn = true @spawning = false # to prevent infinite loops! end ## must be called if you want to see anything! ## once called, will respawn if killed... def make_buf return if @mode.buffer || !BufferManager.instantiated? || !@respawn || @spawning @spawning = true @mode.buffer = BufferManager.instance.spawn "<log>", @mode, :hidden => true @spawning = false end def log s # $stderr.puts s make_buf @mode << "#{Time.now}: #{s.chomp}\n" $stderr.puts "[#{Time.now}] #{s.chomp}" unless @mode.buffer end def self.method_missing m, *a @@instance = Logger.new unless @@instance @@instance.send m, *a end def self.buffer @@instance.buf end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
sup-0.0.4 | lib/sup/logger.rb |
sup-0.0.6 | lib/sup/logger.rb |
sup-0.0.3 | lib/sup/logger.rb |
sup-0.0.5 | lib/sup/logger.rb |
sup-0.0.7 | lib/sup/logger.rb |