Module: DL
- Defined in:
- lib/app-ctx/dlog.rb
Overview
once (shamelessly) stolen(for testing(and squeezed)) from rails… now degenerated beyong comprehension awaiting a major refactoring to get a managble configuration…
Defined Under Namespace
Modules: LoggerMixin Classes: Logger
Constant Summary collapse
- AllLoggersByPrefix =
list of all loggers
{}
Class Method Summary collapse
Class Method Details
.find_prefix(prefix) ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/app-ctx/dlog.rb', line 129 def self.find_prefix prefix raise "nil prefix not yet implemented!" unless prefix return prefix if prefix.kind_of? String return prefix.name if prefix.kind_of? Class return prefix.name if prefix.kind_of? Module return prefix.class.name end |
.logger(prefix = $0, out = $stdout) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/app-ctx/dlog.rb', line 119 def self.logger(prefix = $0, out = $stdout) prefix = self.find_prefix(prefix) unless log = AllLoggersByPrefix[prefix] c = Logger::Config[prefix] || {} #c[:fmt] = "%c %23s %s%s\n" log = (AllLoggersByPrefix[prefix] = Logger.new(prefix, c)) end log end |