Module: ClassLogging::ClassMethods
- Defined in:
- lib/unicorn-cuba-base/root_logger.rb
Instance Method Summary collapse
Instance Method Details
#init_logger ⇒ Object
198 199 200 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 198 def init_logger @@logger = {} unless defined? @@logger end |
#log ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 206 def log unless @@logger.include? self root_logger = if an = ancestors.find{|an| an != self and an.respond_to? :log and an.log.respond_to? :root_logger} an.log.root_logger else RootLogger.new.tap do |logger| logger.warn 'no root logger found; using default logger' end end @@logger[self] = RootLogger::ClassLogger.new(root_logger, self) end @@logger[self] end |
#logger=(logger) ⇒ Object
202 203 204 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 202 def logger=(logger) @@logger[self] = logger end |
#logger_for(class_obj) ⇒ Object
221 222 223 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 221 def logger_for(class_obj) RootLogger::ClassLogger.new(log.root_logger, class_obj) end |