diff tincan.py @ 46:997d0c8c174f draft

Default for the launch callable should be not to log.
author David Barts <n5jrn@me.com>
date Thu, 30 May 2019 16:36:43 -0700
parents 969f515b505b
children 3a6180c1feea
line wrap: on
line diff
--- a/tincan.py	Thu May 30 14:44:09 2019 -0700
+++ b/tincan.py	Thu May 30 16:36:43 2019 -0700
@@ -21,7 +21,6 @@
 from threading import Lock
 import time
 import urllib
-import uuid
 
 import bottle
 
@@ -883,16 +882,15 @@
             elif S_ISDIR(etype):
                 self._launch(subdir + [entry])
 
-def launch(fsroot=None, urlroot='/', logger=None, debug=False,
-    encoding=ENCODING, static=False, multithread=True):
+_BITBUCKET = logging.getLogger(__name__)
+_BITBUCKET.addHandler(logging.NullHandler)
+
+def launch(fsroot=None, urlroot='/', logger=_BITBUCKET, encoding=ENCODING,
+    static=False, multithread=True):
     """
     Launch and return a TinCan webapp. Does not run the app; it is the
     caller's responsibility to call app.run()
     """
-    if logger is None:
-        logger = logging.getLogger("{0!s}-{1!s}".format(__name__, uuid.uuid1()))
-        logger.addHandler(logging.StreamHandler())
-    logger.setLevel(logging.DEBUG if debug else logging.INFO)
     if fsroot is None:
         fsroot = os.getcwd()
     launcher = _Launcher(fsroot, urlroot, multithread)