Class: RubyApp::Log

Inherits:
Logger
  • Object
show all
Extended by:
Mixins::DelegateMixin
Defined in:
lib/ruby_app/log.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::DelegateMixin

method_missing

Class Method Details

.close!Object



32
33
34
35
# File 'lib/ruby_app/log.rb', line 32

def self.close!
  @@_log.close if @@_log
  @@_log = nil
end

.getObject



20
21
22
# File 'lib/ruby_app/log.rb', line 20

def self.get
  @@_log
end

.open!Object



24
25
26
27
28
29
30
# File 'lib/ruby_app/log.rb', line 24

def self.open!
  path = RubyApp::Application.options.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

#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.message}")
  self.error('-' * 80)
  exception.backtrace.each do |line|
    self.error(line)
  end
  self.error('-' * 80)
end