Class: S3Antivirus::Tee
- Inherits:
-
Object
- Object
- S3Antivirus::Tee
- Extended by:
- Memoist
- Defined in:
- lib/s3_antivirus/tee.rb
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ Tee
constructor
A new instance of Tee.
- #logger ⇒ Object
- #method_missing(name, message, &block) ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Tee
Returns a new instance of Tee.
7 8 9 |
# File 'lib/s3_antivirus/tee.rb', line 7 def initialize(path, ={}) @path, @options = path, end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, message, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/s3_antivirus/tee.rb', line 11 def method_missing(name, , &block) if logger.respond_to?(name) # Interesting note about level mapping: http://bit.ly/2PP5Y6Z # Messages from Ruby applications are not considered as critical as messages # from other system daemons using syslog(3), so most messages are reduced by one level. # # Will mimic behavior for puts stdout. # Interestingly, the default logger.level is ::Logger::DEBUG which is 0. # So can't check against that, so will check against the method name. puts unless name == :debug logger.send(name, , &block) else super end end |
Instance Method Details
#logger ⇒ Object
27 28 29 |
# File 'lib/s3_antivirus/tee.rb', line 27 def logger Syslog::Logger.new(@path) end |