Class: TransmissionRSS::Log
- Includes:
- Singleton
- Defined in:
- lib/transmission-rss/log.rb
Overview
Encapsulates Logger as a singleton class.
Instance Method Summary collapse
-
#method_missing(sym, *args) ⇒ Object
If this class misses a method, call it on the encapsulated Logger class.
-
#target=(target) ⇒ Object
Change log target (IO or path to a file as String).
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
If this class misses a method, call it on the encapsulated Logger class.
21 22 23 24 |
# File 'lib/transmission-rss/log.rb', line 21 def method_missing(sym, *args) @logger ||= Logger.new $stderr @logger.send sym, *args end |
Instance Method Details
#target=(target) ⇒ Object
Change log target (IO or path to a file as String).
10 11 12 13 14 15 16 17 18 |
# File 'lib/transmission-rss/log.rb', line 10 def target=(target) old_logger = @logger @logger = Logger.new target if old_logger @logger.level = old_logger.level @logger.formatter = old_logger.formatter end end |