From 47b4d3ee62dfdb830a83192907b0602218f9ab5e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 3 Oct 2008 20:11:06 +0000 Subject: Docs - An "Environment and Configuration" chapter was added to the narrative portion of the documentation. Features - Ensure bfg doesn't generate warnings when running under Python 2.6. - The environment variable ``BFG_RELOAD_TEMPLATES`` is now available (serves the same purpose as ``reload_templates`` in the config file). - A new configuration file option ``debug_authorization`` was added. This turns on printing of security authorization debug statements to ``sys.stderr``. The ``BFG_DEBUG_AUTHORIZATION`` environment variable was also added; this performs the same duty. Bug Fixes - The environment variable ``BFG_SECURITY_DEBUG`` did not always work. It has been renamed to ``BFG_DEBUG_AUTHORIZATION`` and fixed. Deprecations - A deprecation warning is now issued when old API names from the ``repoze.bfg.templates`` module are imported. Backwards incompatibilities - The ``BFG_SECURITY_DEBUG`` environment variable was renamed to ``BFG_DEBUG_AUTHORIZATION``. --- repoze/bfg/log.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 repoze/bfg/log.py (limited to 'repoze/bfg/log.py') diff --git a/repoze/bfg/log.py b/repoze/bfg/log.py new file mode 100644 index 000000000..ac2145a47 --- /dev/null +++ b/repoze/bfg/log.py @@ -0,0 +1,16 @@ +import logging + +def make_stream_logger(name, stream, levelname='DEBUG', + fmt='%(asctime)s %(message)s'): + """ Return an object which implements + ``repoze.bfg.interfaces.ILogger`` (ie. a Python PEP 282 logger + instance) with the name ``name`` using the stream (or open + filehandle) ``stream``, logging at ``levelname`` log level or + above with format ``fmt``. """ + handler = logging.StreamHandler(stream) + formatter = logging.Formatter(fmt) + handler.setFormatter(formatter) + logger = logging.Logger(name) + logger.addHandler(handler) + logger.setLevel(getattr(logging, levelname)) + return logger -- cgit v1.2.3