2012-05-26 12:37:49 +02:00
|
|
|
module Gitlab
|
2012-07-17 07:23:16 +02:00
|
|
|
class Logger < ::Logger
|
2012-05-21 22:17:41 +02:00
|
|
|
def self.error(message)
|
2012-07-17 07:23:16 +02:00
|
|
|
build.error(message)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.info(message)
|
|
|
|
build.info(message)
|
2012-05-21 22:17:41 +02:00
|
|
|
end
|
2012-07-05 20:59:37 +02:00
|
|
|
|
|
|
|
def self.read_latest
|
2012-09-11 22:24:53 +02:00
|
|
|
path = Rails.root.join("log", file_name)
|
2012-07-21 16:30:09 +02:00
|
|
|
self.build unless File.exist?(path)
|
2012-11-29 05:49:11 +01:00
|
|
|
logs = `tail -n 2000 #{path}`.split("\n")
|
2012-07-05 20:59:37 +02:00
|
|
|
end
|
2012-07-17 07:23:16 +02:00
|
|
|
|
2012-12-19 05:14:05 +01:00
|
|
|
def self.read_latest_for filename
|
|
|
|
path = Rails.root.join("log", filename)
|
|
|
|
logs = `tail -n 2000 #{path}`.split("\n")
|
|
|
|
end
|
|
|
|
|
2012-07-17 07:23:16 +02:00
|
|
|
def self.build
|
2012-09-26 20:52:01 +02:00
|
|
|
new(Rails.root.join("log", file_name))
|
2012-07-17 07:23:16 +02:00
|
|
|
end
|
2012-05-21 22:17:41 +02:00
|
|
|
end
|
|
|
|
end
|