]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/logging.py
override
[dak.git] / daklib / logging.py
old mode 100644 (file)
new mode 100755 (executable)
index 11792c8..0cca205
@@ -1,8 +1,12 @@
 #!/usr/bin/env python
 
-# Logging functions
-# Copyright (C) 2001, 2002, 2006  James Troup <james@nocrew.org>
-# $Id: logging.py,v 1.4 2005-11-15 09:50:32 ajt Exp $
+"""
+Logging functions
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2001, 2002, 2006  James Troup <james@nocrew.org>
+@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
 
 ################################################################################
 
-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]