debian-mirror-gitlab/app/models/concerns/project_services_loggable.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
557 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-11-20 20:47:30 +05:30
module ProjectServicesLoggable
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 build_message(message, params = {})
{
service_class: self.class.name,
2021-01-29 00:20:46 +05:30
project_id: project&.id,
project_path: project&.full_path,
2018-11-20 20:47:30 +05:30
message: message
}.merge(params)
end
def logger
Gitlab::ProjectServiceLogger
end
end