class Pbin::Logger

Constants

ERROR_PREFIX
INFO_PREFIX
WARNING_PREFIX

Public Class Methods

new() click to toggle source
# File lib/pbin/logger.rb, line 9
def initialize
  puts "#{now} Logging to #{LOGFILE}"
  @log = File.open(LOGFILE, 'ab')
end

Public Instance Methods

error(text) click to toggle source
# File lib/pbin/logger.rb, line 26
def error(text)
  "#{now} #{ERROR_PREFIX} #{error}"
end
info(text) click to toggle source
# File lib/pbin/logger.rb, line 18
def info(text)
  "#{now} #{INFO_PREFIX} #{text}"
end
now() click to toggle source
# File lib/pbin/logger.rb, line 14
def now
  "#{Time.now.strftime("[%Y-%m-%d %H:%M:%S]")}"
end
warning(text) click to toggle source
# File lib/pbin/logger.rb, line 22
def warning(text)
  "#{now} #{WARNING_PREFIX} #{error}"
end