Welcome to mirror list, hosted at ThFree Co, Russian Federation.

loggable.rb « bitbucket_import « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aeae993b9ebd064618fd22e7cc0d23ef7f60e5b9 (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
38
39
40
41
42
43
44
45
# frozen_string_literal: true

module Gitlab
  module BitbucketImport
    module Loggable
      def log_debug(messages)
        logger.debug(log_data(messages))
      end

      def log_info(messages)
        logger.info(log_data(messages))
      end

      def log_warn(messages)
        logger.warn(log_data(messages))
      end

      def log_error(messages)
        logger.error(log_data(messages))
      end

      def metrics
        Gitlab::Import::Metrics.new(:bitbucket_importer, project)
      end

      private

      def logger
        Gitlab::BitbucketImport::Logger
      end

      def log_data(messages)
        messages.merge(log_base_data)
      end

      def log_base_data
        {
          class: self.class.name,
          project_id: project.id,
          project_path: project.full_path
        }
      end
    end
  end
end