module RuneRb::System::Utils::Logging

Constants

COLOR
LOGGER
LOG_FILE

Public Instance Methods

class_name() click to toggle source

Gets this class' name.

# File deployment/app/system/utils/logging.rb, line 7
def class_name
  self.class.name.split('::').last.to_sym
end
debug(*lines)
Alias for: log!
err(*lines) click to toggle source

Log error lines @param lines [Array] lines of text that are passed to the logger.

# File deployment/app/system/utils/logging.rb, line 41
def err(*lines)
  lines.each do |line|
    LOG_FILE.error(COLOR.strip("[#{Time.now.strftime('[%H:%M')}] #{line}"))
    LOGGER.error(COLOR.magenta.bold("[#{class_name}] ~> #{line}"))
  end
  nil
end
Also aliased as: error
err!(*lines) click to toggle source

Log fatal lines @param lines [Array] lines of text that are passed to the logger.

# File deployment/app/system/utils/logging.rb, line 54
def err!(*lines)
  lines.each do |line|
    LOG_FILE.fatal(COLOR.strip("[#{Time.now.strftime('[%H:%M')}] #{line}"))
    LOGGER.error(COLOR.red.bold("[#{class_name}] ~> #{line}"))
  end
  nil
end
Also aliased as: fatal
error(*lines)
Alias for: err
fatal(*lines)
Alias for: err!
info(*lines)
Alias for: log
log(*lines) click to toggle source

Log info lines @param lines [Array] lines of text that are passed to the logger.

# File deployment/app/system/utils/logging.rb, line 14
def log(*lines)
  lines.each do |line|
    LOG_FILE.info(COLOR.strip("[#{Time.now.strftime('[%H:%M')}] #{line}"))
    LOGGER.info(COLOR.white("[#{class_name}] -> #{line}"))
  end
  nil
end
Also aliased as: info
log!(*lines) click to toggle source

Log warning lines @param lines [Array] lines of text that are passed to the logger.

# File deployment/app/system/utils/logging.rb, line 27
def log!(*lines)
  lines.each do |line|
    LOG_FILE.warn(COLOR.strip("[#{Time.now.strftime('[%H:%M')}] #{line}"))
    LOGGER.warn(COLOR.yellow("[#{class_name}] -> #{line}"))
  end
  nil
end
Also aliased as: debug, warn
symbolize_file(string) click to toggle source

Returns the file name as a symbol. @param string [String] The path to the file.

# File deployment/app/system/utils/logging.rb, line 66
def symbolize_file(string)
  File.basename(string, '*.rb').to_sym
end
warn(*lines)
Alias for: log!