]> git.decadent.org.uk Git - dak.git/commitdiff
daklog: Add username in every log line
authorFrank Lichtenheld <djpig@debian.org>
Tue, 27 Oct 2009 14:05:09 +0000 (14:05 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Tue, 27 Oct 2009 14:05:09 +0000 (14:05 +0000)
Signed-off-by: Frank Lichtenheld <djpig@debian.org>
dak/process_new.py
daklib/daklog.py

index f01f4b91b1278e6549963da4c2fb1359aa2289a6..1423d7056eb791f3b7aa5767a9f48bf60d37a4b5 100755 (executable)
@@ -695,7 +695,7 @@ def do_new(upload, session):
             try:
                 check_daily_lock()
                 done = add_overrides (new, upload, session)
-                Logger.log([utils.getusername(), "NEW ACCEPT: %s" % (upload.pkg.changes_file)])
+                Logger.log(["NEW ACCEPT: %s" % (upload.pkg.changes_file)])
             except CantGetLockError:
                 print "Hello? Operator! Give me the number for 911!"
                 print "Dinstall in the locked area, cant process packages, come back later"
@@ -708,7 +708,7 @@ def do_new(upload, session):
                                        reject_message=Options["Manual-Reject"],
                                        note=get_new_comments(changes.get("source", ""), session=session))
             if not aborted:
-                Logger.log([utils.getusername(), "NEW REJECT: %s" % (upload.pkg.changes_file)])
+                Logger.log(["NEW REJECT: %s" % (upload.pkg.changes_file)])
                 os.unlink(upload.pkg.changes_file[:-8]+".dak")
                 done = 1
         elif answer == 'N':
@@ -717,7 +717,7 @@ def do_new(upload, session):
         elif answer == 'P' and not Options["Trainee"]:
             prod_maintainer(get_new_comments(changes.get("source", ""), session=session),
                             upload)
-            Logger.log([utils.getusername(), "NEW PROD: %s" % (upload.pkg.changes_file)])
+            Logger.log(["NEW PROD: %s" % (upload.pkg.changes_file)])
         elif answer == 'R' and not Options["Trainee"]:
             confirm = utils.our_raw_input("Really clear note (y/N)? ").lower()
             if confirm == "y":
@@ -792,12 +792,12 @@ def do_byhand(upload, session):
                 done = 1
                 for f in byhand:
                     del files[f]
-                Logger.log([utils.getusername(), "BYHAND ACCEPT: %s" % (upload.pkg.changes_file)])
+                Logger.log(["BYHAND ACCEPT: %s" % (upload.pkg.changes_file)])
             except CantGetLockError:
                 print "Hello? Operator! Give me the number for 911!"
                 print "Dinstall in the locked area, cant process packages, come back later"
         elif answer == 'M':
-            Logger.log([utils.getusername(), "BYHAND REJECT: %s" % (upload.pkg.changes_file)])
+            Logger.log(["BYHAND REJECT: %s" % (upload.pkg.changes_file)])
             upload.do_reject(manual=1, reject_message=Options["Manual-Reject"])
             os.unlink(upload.pkg.changes_file[:-8]+".dak")
             done = 1
@@ -1017,7 +1017,7 @@ def end():
         if accept_count > 1:
             sets = "sets"
         sys.stderr.write("Accepted %d package %s, %s.\n" % (accept_count, sets, utils.size_type(int(accept_bytes))))
-        Logger.log([utils.getusername(), "total",accept_count,accept_bytes])
+        Logger.log(["total",accept_count,accept_bytes])
 
     if not Options["No-Action"] and not Options["Trainee"]:
         Logger.close()
index 0cca205e96bf83b6e1cad2c7f785e650c814b848..dfcae368089f0c1d2a0d2e56b9e6e8fa218c6d6a 100755 (executable)
@@ -58,13 +58,12 @@ class Logger:
             logfile = utils.open_file(logfilename, 'a')
             os.umask(umask)
         self.logfile = logfile
-        # Log the start of the program
-        user = pwd.getpwuid(os.getuid())[0]
-        self.log(["program start", user])
+        self.log(["program start"])
 
     def log (self, details):
         "Log an event"
-        # Prepend the timestamp and program name
+        # Prepend timestamp, program name, and user name
+        details.insert(0, utils.getusername())
         details.insert(0, self.program)
         timestamp = time.strftime("%Y%m%d%H%M%S")
         details.insert(0, timestamp)