gitlab-org--gitlab-foss/lib/gitlab/logger.rb
Pat Thoyts 6035ad7e1f Create the githost.log file if necessary.
This resolves issue #1121.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2012-07-21 15:32:04 +01:00

25 lines
550 B
Ruby

module Gitlab
class Logger < ::Logger
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/githost.log")
self.build unless File.exist?(path)
logs = File.read(path).split("\n")
end
def self.build
new(File.join(Rails.root, "log/githost.log"))
end
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n"
end
end
end