class Tagrity::Command::Logs

Public Class Methods

call(n, debug) click to toggle source
# File lib/tagrity/commands/logs.rb, line 8
def call(n, debug)
  if File.readable?(logf)
    system("cat #{logf} | grep -F #{log_levels(debug).map { |lvl| " -e '#{lvl}' " }.join} | tail -n #{Integer(n)}")
  else
    puts "Error: There doesn't seem to be a log file for #{Dir.pwd}"
  end
end

Private Class Methods

log_levels(debug) click to toggle source
# File lib/tagrity/commands/logs.rb, line 18
def log_levels(debug)
  levels = ['INFO', 'WARN', 'ERROR', 'FATAL', 'UNKNOWN']
  levels << 'DEBUG' if debug
  levels
end
logf() click to toggle source
# File lib/tagrity/commands/logs.rb, line 24
def logf
  Provider.provide(:tlogger).logf
end