Class: Gitlab::JsonLogger

Inherits:
Labkit::Logging::JsonLogger
  • Object
show all
Defined in:
lib/gitlab/json_logger.rb

Class Method Summary collapse

Class Method Details

.buildObject



31
32
33
34
# File 'lib/gitlab/json_logger.rb', line 31

def build
  Gitlab::SafeRequestStore[cache_key] ||=
    new(full_log_path, level: log_level)
end

.cache_keyObject



36
37
38
# File 'lib/gitlab/json_logger.rb', line 36

def cache_key
  "logger:" + full_log_path.to_s
end

.debug(message) ⇒ Object



15
16
17
# File 'lib/gitlab/json_logger.rb', line 15

def debug(message)
  build.debug(message)
end

.error(message) ⇒ Object



19
20
21
# File 'lib/gitlab/json_logger.rb', line 19

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

.file_nameObject



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

def file_name
  file_name_noext + ".log"
end

.file_name_noextObject

Raises:

  • (NotImplementedError)


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

def file_name_noext
  raise NotImplementedError, "JsonLogger implementations must provide file_name_noext implementation"
end

.full_log_pathObject



40
41
42
# File 'lib/gitlab/json_logger.rb', line 40

def full_log_path
  Rails.root.join("log", file_name)
end

.info(message) ⇒ Object



27
28
29
# File 'lib/gitlab/json_logger.rb', line 27

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

.warn(message) ⇒ Object



23
24
25
# File 'lib/gitlab/json_logger.rb', line 23

def warn(message)
  build.warn(message)
end