Class: Gitlab::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/gitlab/logger.rb

Class Method Summary collapse

Class Method Details

.buildObject


28
29
30
# File 'lib/gitlab/logger.rb', line 28

def self.build
  new(Rails.root.join("log", file_name))
end

.error(message) ⇒ Object


7
8
9
# File 'lib/gitlab/logger.rb', line 7

def self.error(message)
  build.error(message)
end

.file_nameObject


3
4
5
# File 'lib/gitlab/logger.rb', line 3

def self.file_name
  file_name_noext + '.log'
end

.info(message) ⇒ Object


11
12
13
# File 'lib/gitlab/logger.rb', line 11

def self.info(message)
  build.info(message)
end

.read_latestObject


15
16
17
18
19
20
# File 'lib/gitlab/logger.rb', line 15

def self.read_latest
  path = Rails.root.join("log", file_name)
  self.build unless File.exist?(path)
  tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
  tail_output.split("\n")
end

.read_latest_for(filename) ⇒ Object


22
23
24
25
26
# File 'lib/gitlab/logger.rb', line 22

def self.read_latest_for(filename)
  path = Rails.root.join("log", filename)
  tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
  tail_output.split("\n")
end