From: Frank Lichtenheld Date: Tue, 27 Oct 2009 14:05:09 +0000 (+0000) Subject: daklog: Add username in every log line X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b4e3c53932577a6320da839ef998c5710ddadd2b;p=dak.git daklog: Add username in every log line Signed-off-by: Frank Lichtenheld --- diff --git a/dak/process_new.py b/dak/process_new.py index f01f4b91..1423d705 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -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() diff --git a/daklib/daklog.py b/daklib/daklog.py index 0cca205e..dfcae368 100755 --- a/daklib/daklog.py +++ b/daklib/daklog.py @@ -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)