Sha256: ce5b69d32b0ba92a361e03f6178fe8786a652a869c8e2ac745d5e4e9f32a0c2b
Contents?: true
Size: 1.39 KB
Versions: 4
Compression:
Stored size: 1.39 KB
Contents
require 'omf_base/lobject' module Thin # Overwrite thin's logging mix-in to work more nicely # with log4r # module Logging class << self attr_writer :trace, :debug, :silent def trace?; !@silent && @trace end def debug?; !@silent && @debug end def silent?; @silent end end # # Global silencer methods # def silent # Logging.silent? # end # def silent=(value) # Logging.silent = value # end # Log a message to the console def log(msg) (@logger ||= OMF::Base::LObject.new(self.class)).info(msg) end module_function :log public :log # Log a message to the console if tracing is activated def trace(msg=nil) ### DO NOT COMMIT!!!! Can't figure out where tracing is switched on return ##### return unless msg (@logger ||= OMF::Base::LObject.new(self.class)).debug(msg) end module_function :trace public :trace # Log a message to the console if debugging is activated def debug(msg=nil) return unless msg (@logger ||= OMF::Base::LObject.new(self.class)).debug(msg) end module_function :debug public :debug # Log an error backtrace if debugging is activated def log_error(e = $!) (@logger ||= OMF::Base::LObject.new(self.class)).error(e) end module_function :log_error public :log_error end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
omf_web-1.2.3 | lib/omf-web/thin/logging.rb |
omf_web-1.2.2 | lib/omf-web/thin/logging.rb |
omf_web-1.2.1 | lib/omf-web/thin/logging.rb |
omf_web-1.2.0 | lib/omf-web/thin/logging.rb |