2012-05-26 06:37:49 -04:00
|
|
|
module Gitlab
|
2012-07-17 01:23:16 -04:00
|
|
|
class Logger < ::Logger
|
2012-05-21 16:17:41 -04:00
|
|
|
def self.error(message)
|
2012-07-17 01:23:16 -04:00
|
|
|
build.error(message)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.info(message)
|
|
|
|
build.info(message)
|
2012-05-21 16:17:41 -04:00
|
|
|
end
|
2012-07-05 14:59:37 -04:00
|
|
|
|
|
|
|
def self.read_latest
|
|
|
|
path = Rails.root.join("log/githost.log")
|
2012-07-21 10:30:09 -04:00
|
|
|
self.build unless File.exist?(path)
|
2012-07-16 01:03:10 -04:00
|
|
|
logs = File.read(path).split("\n")
|
2012-07-05 14:59:37 -04:00
|
|
|
end
|
2012-07-17 01:23:16 -04:00
|
|
|
|
|
|
|
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
|
2012-05-21 16:17:41 -04:00
|
|
|
end
|
|
|
|
end
|