Class: RubyApp::Log
- Inherits:
-
Logger
- Object
- Logger
- RubyApp::Log
- Extended by:
- Mixins::DelegateMixin
- Defined in:
- lib/ruby_app/log.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Mixins::DelegateMixin
Class Method Details
.close! ⇒ Object
39 40 41 42 43 |
# File 'lib/ruby_app/log.rb', line 39 def self.close! @@_log.debug("#{self}##{__method__}") @@_log.close if @@_log @@_log = nil end |
.get ⇒ Object
27 28 29 |
# File 'lib/ruby_app/log.rb', line 27 def self.get @@_log end |
.open! ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/ruby_app/log.rb', line 31 def self.open! path = RubyApp::Application..log_path directory = File.dirname(path) Dir.mkdir(directory) unless File.exists?(directory) @@_log = RubyApp::Log.new(path) @@_log.debug("#{self}##{__method__} path=#{path.inspect}") end |
Instance Method Details
#duration(message) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/ruby_app/log.rb', line 20 def duration() start = Time.now result = yield if block_given? self.debug("#{} duration=#{Time.now - start}s") return result end |
#exception(exception) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/ruby_app/log.rb', line 10 def exception(exception) self.error('-' * 80) self.error("exception=#{exception.class.inspect} #{exception.}") self.error('-' * 80) exception.backtrace.each do |line| self.error(line) end self.error('-' * 80) end |