tools.py: patch to fix make_log/log for python installations with logging module

Steven Armstrong <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
Hi all

The subject is the message.

cheers
Steven
tools.py.diff (text/plain, 1.1 KB)
Index: tools.py
===================================================================
RCS file: /cvsroot/pyblosxom/pyblosxom/Pyblosxom/tools.py,v
retrieving revision 1.37
diff -u -r1.37 tools.py
--- tools.py	8 Dec 2004 01:20:07 -0000	1.37
+++ tools.py	10 Dec 2004 11:42:41 -0000
@@ -511,15 +511,21 @@
             f.write("\n")
             f.close()
     else:
-        logger = logging.getLogger('trackback')
+        # if all loggers have the same name,
+        # everything is logged to all files.
+        loggerName = filename.split(os.sep)[-1:][0].split(".")[0]
+        logger = logging.getLogger(loggerName)
         hdlr = logging.FileHandler(filename)
         formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
         hdlr.setFormatter(formatter)
         logger.addHandler(hdlr) 
         logger.setLevel(logging.INFO)
 
-        def log(str):
-            logger.info(str)
+        def log(*args):
+            # adjusted to match the 'manual' log func
+            for i in args:
+                logger.info(repr(i))
+
 
 
 def update_static_entry(cdict, entry_filename):
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.