gitlab-org--gitlab-foss/lib/gitlab/logger.rb

33 lines
726 B
Ruby
Raw Normal View History

module Gitlab
class Logger < ::Logger
2014-10-04 11:09:06 -04:00
def self.file_name
file_name_noext + '.log'
end
def self.error(message)
build.error(message)
end
def self.info(message)
build.info(message)
end
def self.read_latest
2012-09-11 16:24:53 -04:00
path = Rails.root.join("log", file_name)
self.build unless File.exist?(path)
2014-02-25 06:12:09 -05:00
tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
tail_output.split("\n")
end
def self.read_latest_for(filename)
path = Rails.root.join("log", filename)
2014-02-25 06:12:09 -05:00
tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
tail_output.split("\n")
end
def self.build
2012-09-26 14:52:01 -04:00
new(Rails.root.join("log", file_name))
end
end
end