OSDN Git Service

satellites logs
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 29 Jan 2013 10:12:24 +0000 (12:12 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 29 Jan 2013 10:12:24 +0000 (12:12 +0200)
lib/gitlab/satellite/logger.rb [new file with mode: 0644]
lib/gitlab/satellite/satellite.rb

diff --git a/lib/gitlab/satellite/logger.rb b/lib/gitlab/satellite/logger.rb
new file mode 100644 (file)
index 0000000..6f3f825
--- /dev/null
@@ -0,0 +1,13 @@
+module Gitlab
+  module Satellite
+    class Logger < Gitlab::Logger
+      def self.file_name
+        'satellites.log'
+      end
+
+      def format_message(severity, timestamp, progname, msg)
+        "#{timestamp.to_s(:long)}: #{msg}\n"
+      end
+    end
+  end
+end
index d8e8f58..95273a6 100644 (file)
@@ -13,6 +13,10 @@ module Gitlab
         @project = project
       end
 
+      def log message
+        Gitlab::Satellite::Logger.error(message)
+      end
+
       def raise_no_satellite
         raise SatelliteNotExistError.new("Satellite doesn't exist")
       end
@@ -29,10 +33,13 @@ module Gitlab
         output, status = popen("git clone #{project.url_to_repo} #{path}",
                                Gitlab.config.satellites.path)
 
+        log("PID: #{project.id}: git clone #{project.url_to_repo} #{path}")
+        log("PID: #{project.id}: -> #{output}")
+
         if status.zero?
           true
         else
-          Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}")
+          log("Failed to create satellite for #{project.name_with_namespace}")
           false
         end
       end