Class: JCW::Logger
- Inherits:
-
Object
- Object
- JCW::Logger
- Defined in:
- lib/jcw/logger.rb
Constant Summary collapse
- LEVELS =
{ ::Logger::UNKNOWN => "unknown", ::Logger::FATAL => "fatal", ::Logger::ERROR => "error", ::Logger::WARN => "warn", ::Logger::INFO => "info", ::Logger::DEBUG => "debug", }.freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.current ⇒ Object
15 16 17 |
# File 'lib/jcw/logger.rb', line 15 def current Thread.current[:jaeger_logger] ||= new end |
Instance Method Details
#add(level, message, progname) ⇒ Object
20 21 22 23 |
# File 'lib/jcw/logger.rb', line 20 def add(level, , progname) ||= progname logs << { level: LEVELS[level], message: } unless .to_s.empty? end |
#clear ⇒ Object
29 30 31 |
# File 'lib/jcw/logger.rb', line 29 def clear @logs = [] end |
#logs ⇒ Object
25 26 27 |
# File 'lib/jcw/logger.rb', line 25 def logs @logs ||= [] end |