blob: 57847ea335c6b05ccb54210905b16700c49589b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# frozen_string_literal: true
module Integrations
module Loggable
def log_info(message, params = {})
message = build_message(message, params)
logger.info(message)
end
def log_error(message, params = {})
message = build_message(message, params)
logger.error(message)
end
def log_exception(error, params = {})
Gitlab::ExceptionLogFormatter.format!(error, params)
log_error(params[:message] || error.message, params)
end
def build_message(message, params = {})
{
integration_class: self.class.name,
integration_id: id,
project_id: project&.id,
project_path: project&.full_path,
message: message
}.merge(params)
end
def logger
Gitlab::IntegrationsLogger
end
end
end
|