Module: Gecode::LoggingLayer
- Defined in:
- lib/gecoder/bindings.rb
Overview
Describes a layer that delegates to GecodeRaw only after having logged the call.
Class Method Summary collapse
- .const_missing(name) ⇒ Object
-
.logger ⇒ Object
Gets the logger, or creates one if none exists.
- .method_missing(name, *args) ⇒ Object
Class Method Details
.const_missing(name) ⇒ Object
80 81 82 |
# File 'lib/gecoder/bindings.rb', line 80 def self.const_missing(name) ::GecodeRaw.const_get(name) end |
.logger ⇒ Object
Gets the logger, or creates one if none exists.
85 86 87 88 89 90 91 |
# File 'lib/gecoder/bindings.rb', line 85 def self.logger return @logger unless @logger.nil? file = open('gecoder.log', File::WRONLY | File::APPEND | File::CREAT) @logger = ::Logger.new(file) @logger.datetime_format = "%Y-%m-%d %H:%M:%S" @logger end |
.method_missing(name, *args) ⇒ Object
75 76 77 78 |
# File 'lib/gecoder/bindings.rb', line 75 def self.method_missing(name, *args) logger.info{ "#{name}(#{args.join(', ')})" } ::GecodeRaw.send(name, *args) end |