Class: Vedeu::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/support/log.rb

Class Method Summary collapse

Class Method Details

.directoryString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


98
99
100
101
102
# File 'lib/vedeu/support/log.rb', line 98

def self.directory
  FileUtils.mkdir_p(path) unless File.directory?(path)

  path
end

.filenameString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


92
93
94
# File 'lib/vedeu/support/log.rb', line 92

def self.filename
  @_filename ||= directory + '/vedeu.log'
end

.loggerTrueClass

Returns:

  • (TrueClass)


80
81
82
83
84
85
86
# File 'lib/vedeu/support/log.rb', line 80

def self.logger
  @logger ||= MonoLogger.new(filename).tap do |log|
    log.formatter = proc do |_, time, _, message|
      time.utc.iso8601 + ": " + message + "\n"
    end
  end
end

.pathString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


106
107
108
# File 'lib/vedeu/support/log.rb', line 106

def self.path
  Dir.home + '/.vedeu'
end