Class: Leafy::Logger::ProxyLogger
- Inherits:
-
Object
- Object
- Leafy::Logger::ProxyLogger
- Defined in:
- lib/leafy/logger/proxy_logger.rb
Instance Attribute Summary collapse
-
#formatter ⇒ Object
Provided for compatibility with the stdlib Logger interface.
Instance Method Summary collapse
-
#fatal(*args) ⇒ Object
slf4j does not include the fatal level.
-
#initialize(logger) ⇒ ProxyLogger
constructor
A new instance of ProxyLogger.
- #method_missing(sym, *args, &block) ⇒ Object
- #respond_to?(sym, include_private = false) ⇒ Boolean
Constructor Details
#initialize(logger) ⇒ ProxyLogger
Returns a new instance of ProxyLogger.
4 5 6 |
# File 'lib/leafy/logger/proxy_logger.rb', line 4 def initialize(logger) @logger = logger end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/leafy/logger/proxy_logger.rb', line 8 def method_missing(sym, *args, &block) if @logger.respond_to?(sym) @logger.send(sym, *args) else super end end |
Instance Attribute Details
#formatter ⇒ Object
Provided for compatibility with the stdlib Logger interface. Not used, since the logger that we’re proxying has a much better formatter! (Right?)
27 28 29 |
# File 'lib/leafy/logger/proxy_logger.rb', line 27 def formatter @formatter end |
Instance Method Details
#fatal(*args) ⇒ Object
slf4j does not include the fatal level
21 22 23 |
# File 'lib/leafy/logger/proxy_logger.rb', line 21 def fatal(*args) error(*args) end |
#respond_to?(sym, include_private = false) ⇒ Boolean
16 17 18 |
# File 'lib/leafy/logger/proxy_logger.rb', line 16 def respond_to?(sym, include_private = false) @logger.respond_to?(sym, include_private) end |