diff --git a/mitogen/utils.py b/mitogen/utils.py index 51f9a3c7..d7ccc342 100644 --- a/mitogen/utils.py +++ b/mitogen/utils.py @@ -27,7 +27,7 @@ def log_to_tmp(): log_to_file(path='/tmp/mitogen.%s.log' % (os.getpid(),)) -def log_to_file(path=None, io=True, level=logging.INFO): +def log_to_file(path=None, io=True, level='INFO'): """Install a new :py:class:`logging.Handler` writing applications logs to the filesystem. Useful when debugging slave IO problems.""" log = logging.getLogger('') @@ -37,6 +37,7 @@ def log_to_file(path=None, io=True, level=logging.INFO): else: fp = sys.stderr + level = getattr(logging, level, logging.INFO) log.setLevel(level) if io: logging.getLogger('mitogen.io').setLevel(level) diff --git a/tests/data/webproject/serve_django_app.py b/tests/data/webproject/serve_django_app.py index 19f348c5..afa67f0c 100644 --- a/tests/data/webproject/serve_django_app.py +++ b/tests/data/webproject/serve_django_app.py @@ -27,7 +27,7 @@ def serve_django_app(settings_name): def main(broker): import logging - mitogen.utils.log_to_file(level=logging.INFO, io=False) + mitogen.utils.log_to_file(io=False) context = mitogen.master.connect(broker) context.call(os.chdir, '/') #context.call(mitogen.utils.log_to_file, '/tmp/log') diff --git a/tests/proxy_test.py b/tests/proxy_test.py index c6bbf937..4c05cb3a 100644 --- a/tests/proxy_test.py +++ b/tests/proxy_test.py @@ -7,7 +7,7 @@ import mitogen.utils @mitogen.utils.run_with_router def main(router): - mitogen.utils.log_to_file(io=False, level=logging.INFO) + mitogen.utils.log_to_file(io=False) child1 = router.ssh(name='u', hostname='u') child2 = router.sudo( username='sudo_pw_test',