Module: ProjectServicesLoggable

Included in:
Jira::Requests::Base, Service
Defined in:
app/models/concerns/project_services_loggable.rb

Instance Method Summary collapse

Instance Method Details

#build_message(message, params = {}) ⇒ Object


16
17
18
19
20
21
22
23
# File 'app/models/concerns/project_services_loggable.rb', line 16

def build_message(message, params = {})
  {
    service_class: self.class.name,
    project_id: project&.id,
    project_path: project&.full_path,
    message: message
  }.merge(params)
end

#log_error(message, params = {}) ⇒ Object


10
11
12
13
14
# File 'app/models/concerns/project_services_loggable.rb', line 10

def log_error(message, params = {})
  message = build_message(message, params)

  logger.error(message)
end

#log_info(message, params = {}) ⇒ Object


4
5
6
7
8
# File 'app/models/concerns/project_services_loggable.rb', line 4

def log_info(message, params = {})
  message = build_message(message, params)

  logger.info(message)
end

#loggerObject


25
26
27
# File 'app/models/concerns/project_services_loggable.rb', line 25

def logger
  Gitlab::ProjectServiceLogger
end