Module: Gitlab::Ci::Artifacts::Logger
- Defined in:
- lib/gitlab/ci/artifacts/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
- #log_artifacts_context(job) ⇒ Object
- #log_artifacts_filesize(artifact_file) ⇒ Object
- #log_build_dependencies(size:, count: 0) ⇒ Object
Class Method Details
.log_created(job_artifacts) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gitlab/ci/artifacts/logger.rb', line 32 def self.log_created(job_artifacts) Array(job_artifacts).each do |artifact| payload = Gitlab::ApplicationContext.current.merge( message: 'Artifact created', job_artifact_id: artifact.id, size: artifact.size, file_type: artifact.file_type, build_id: artifact.job_id, project_id: artifact.project_id ) Gitlab::AppLogger.info(payload) end end |
.log_deleted(job_artifacts, method) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gitlab/ci/artifacts/logger.rb', line 47 def self.log_deleted(job_artifacts, method) Array(job_artifacts).each do |artifact| payload = Gitlab::ApplicationContext.current.merge( message: 'Artifact deleted', job_artifact_id: artifact.id, expire_at: artifact.expire_at, size: artifact.size, file_type: artifact.file_type, build_id: artifact.job_id, project_id: artifact.project_id, method: method ) Gitlab::AppLogger.info(payload) end end |
Instance Method Details
#log_artifacts_context(job) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/gitlab/ci/artifacts/logger.rb', line 17 def log_artifacts_context(job) ::Gitlab::ApplicationContext.push( namespace: job&.project&.namespace, project: job&.project, job: job ) end |
#log_artifacts_filesize(artifact_file) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/gitlab/ci/artifacts/logger.rb', line 7 def log_artifacts_filesize(artifact_file) return if artifact_file.nil? unless artifact_file.is_a?(::Ci::Artifactable) raise ArgumentError, "unknown artifact file class `#{artifact_file.class}`" end ::Gitlab::ApplicationContext.push(artifact: artifact_file) end |
#log_build_dependencies(size:, count: 0) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/gitlab/ci/artifacts/logger.rb', line 25 def log_build_dependencies(size:, count: 0) ::Gitlab::ApplicationContext.push( artifacts_dependencies_size: size, artifacts_dependencies_count: count ) end |