debian-mirror-gitlab/lib/gitlab/logger.rb

33 lines
726 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Gitlab
class Logger < ::Logger
2015-04-26 12:48:37 +05:30
def self.file_name
file_name_noext + '.log'
end
2014-09-02 18:07:02 +05:30
def self.error(message)
build.error(message)
end
def self.info(message)
build.info(message)
end
def self.read_latest
path = Rails.root.join("log", file_name)
self.build unless File.exist?(path)
tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
tail_output.split("\n")
end
2015-04-26 12:48:37 +05:30
def self.read_latest_for(filename)
2014-09-02 18:07:02 +05:30
path = Rails.root.join("log", filename)
tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
tail_output.split("\n")
end
def self.build
new(Rails.root.join("log", file_name))
end
end
end