Commit c84675ee06dfc72c46c178ef40e30f03053dcc5a

Authored by Dmitriy Zaporozhets
1 parent 7121a58e

satellites logs

lib/gitlab/satellite/logger.rb 0 → 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +module Gitlab
  2 + module Satellite
  3 + class Logger < Gitlab::Logger
  4 + def self.file_name
  5 + 'satellites.log'
  6 + end
  7 +
  8 + def format_message(severity, timestamp, progname, msg)
  9 + "#{timestamp.to_s(:long)}: #{msg}\n"
  10 + end
  11 + end
  12 + end
  13 +end
lib/gitlab/satellite/satellite.rb
@@ -13,6 +13,10 @@ module Gitlab @@ -13,6 +13,10 @@ module Gitlab
13 @project = project 13 @project = project
14 end 14 end
15 15
  16 + def log message
  17 + Gitlab::Satellite::Logger.error(message)
  18 + end
  19 +
16 def raise_no_satellite 20 def raise_no_satellite
17 raise SatelliteNotExistError.new("Satellite doesn't exist") 21 raise SatelliteNotExistError.new("Satellite doesn't exist")
18 end 22 end
@@ -29,10 +33,13 @@ module Gitlab @@ -29,10 +33,13 @@ module Gitlab
29 output, status = popen("git clone #{project.url_to_repo} #{path}", 33 output, status = popen("git clone #{project.url_to_repo} #{path}",
30 Gitlab.config.satellites.path) 34 Gitlab.config.satellites.path)
31 35
  36 + log("PID: #{project.id}: git clone #{project.url_to_repo} #{path}")
  37 + log("PID: #{project.id}: -> #{output}")
  38 +
32 if status.zero? 39 if status.zero?
33 true 40 true
34 else 41 else
35 - Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}") 42 + log("Failed to create satellite for #{project.name_with_namespace}")
36 false 43 false
37 end 44 end
38 end 45 end