Sha256: 20782c2179332a1c4c4184a6aa10679566cd51f95321d844d6fd1adbee74857a
Contents?: true
Size: 766 Bytes
Versions: 2
Compression:
Stored size: 766 Bytes
Contents
require 'logger' class Radiodan module Logging @@output = '/dev/null' @@level = :DEBUG def self.included(klass) klass.extend ClassMethods end def self.output=(output) @@output = output STDOUT.sync = true if @@output == STDOUT end def self.output @@output end def logger self.class.logger end def self.level=(level) @@level = Logger.const_get(level.to_sym.upcase) end def self.level @@level end module ClassMethods @@logs = {} def logger unless @@logs.include? self.name new_log = Logger.new(Logging.output) new_log.progname = self.name new_log.level = Logging.level @@logs[self.name] = new_log end @@logs[self.name] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
radiodan-1.0.1 | lib/radiodan/logging.rb |
radiodan-1.0.0 | lib/radiodan/logging.rb |