Application logger

This commit is contained in:
randx 2012-09-11 23:24:53 +03:00
parent 4903910390
commit 0523b4265b
10 changed files with 86 additions and 20 deletions

View file

@ -9,17 +9,13 @@ module Gitlab
end
def self.read_latest
path = Rails.root.join("log/githost.log")
path = Rails.root.join("log", file_name)
self.build unless File.exist?(path)
logs = File.read(path).split("\n")
end
def self.build
new(File.join(Rails.root, "log/githost.log"))
new(File.join(Rails.root, "log", file_name))
end
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n"
end
end
end