Class: Gitlab::Ci::Pipeline::CommandLogger
- Inherits:
-
Object
- Object
- Gitlab::Ci::Pipeline::CommandLogger
- Defined in:
- lib/gitlab/ci/pipeline/command_logger.rb
Instance Method Summary collapse
- #commit(pipeline:, command:) ⇒ Object
-
#initialize(destination: Gitlab::AppJsonLogger) ⇒ CommandLogger
constructor
A new instance of CommandLogger.
Constructor Details
#initialize(destination: Gitlab::AppJsonLogger) ⇒ CommandLogger
Returns a new instance of CommandLogger.
7 8 9 |
# File 'lib/gitlab/ci/pipeline/command_logger.rb', line 7 def initialize(destination: Gitlab::AppJsonLogger) @destination = destination end |
Instance Method Details
#commit(pipeline:, command:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gitlab/ci/pipeline/command_logger.rb', line 11 def commit(pipeline:, command:) return unless log? attributes = Gitlab::ApplicationContext.current.merge( "class" => self.class.name.to_s, "pipeline_command.source" => command.source, "pipeline_command.project_id" => command.project&.id, "pipeline_command.current_user_id" => command.current_user&.id, "pipeline_command.merge_request_id" => command.merge_request&.id, "pipeline_persisted" => pipeline.persisted?, "pipeline_id" => pipeline.id ) attributes.compact! attributes.stringify_keys! destination.info(attributes) end |