X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Flogging.py;h=0cca205e96bf83b6e1cad2c7f785e650c814b848;hb=b43ed3ff3738940ce46caa836d88b6937a76582c;hp=bd81582a2bceaf64651edf05c6ec6b4934f1c8c9;hpb=e2ae71066cbb134753d7bfceb16e87d0b76dfd6e;p=dak.git diff --git a/daklib/logging.py b/daklib/logging.py old mode 100644 new mode 100755 index bd81582a..0cca205e --- a/daklib/logging.py +++ b/daklib/logging.py @@ -1,8 +1,12 @@ #!/usr/bin/env python -# Logging functions -# Copyright (C) 2001, 2002 James Troup -# $Id: logging.py,v 1.4 2005-11-15 09:50:32 ajt Exp $ +""" +Logging functions + +@contact: Debian FTP Master +@copyright: 2001, 2002, 2006 James Troup +@license: GNU General Public License version 2 or later +""" # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +24,10 @@ ################################################################################ -import os, pwd, time, sys +import os +import pwd +import time +import sys import utils ################################################################################ @@ -40,13 +47,16 @@ class Logger: if not os.path.exists(logdir): umask = os.umask(00000) os.makedirs(logdir, 02775) + os.umask(umask) # Open the logfile logfilename = "%s/%s" % (logdir, time.strftime("%Y-%m")) - logfile = None - if debug: - logfile = sys.stderr - else: - logfile = utils.open_file(logfilename, 'a') + logfile = None + if debug: + logfile = sys.stderr + else: + umask = os.umask(00002) + logfile = utils.open_file(logfilename, 'a') + os.umask(umask) self.logfile = logfile # Log the start of the program user = pwd.getpwuid(os.getuid())[0] @@ -59,7 +69,7 @@ class Logger: timestamp = time.strftime("%Y%m%d%H%M%S") details.insert(0, timestamp) # Force the contents of the list to be string.join-able - details = map(str, details) + details = [ str(i) for i in details ] # Write out the log in TSV self.logfile.write("|".join(details)+'\n') # Flush the output to enable tail-ing