logger.rb 560 Bytes
Newer Older
1
module Gitlab
2
  class Logger < ::Logger
3
    def self.error(message)
4 5 6 7 8
      build.error(message)
    end

    def self.info(message)
      build.info(message)
9
    end
10 11

    def self.read_latest
randx's avatar
randx committed
12
      path = Rails.root.join("log", file_name)
13
      self.build unless File.exist?(path)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
14
      logs = `tail -n 2000 #{path}`.split("\n")
15
    end
16

17 18 19 20 21
    def self.read_latest_for filename
      path = Rails.root.join("log", filename)
      logs = `tail -n 2000 #{path}`.split("\n")
    end

22
    def self.build
23
      new(Rails.root.join("log", file_name))
24
    end
25 26
  end
end