It provides a simple WSGI middleware that helps to log messages into JavaScript console
object. For example, if you log messages like:
logger = logging.getLogger('my.logger')
logger.warning('warning message')
logger.debug('debug message')
The middleware automatically appends codes like following JavaScript:
<script>
// <![CDATA[
if (console) {
console.warn('my.logger: warning message');
console.debug('my.logger: debug message');
}
// ]]>
</script>
You can install it by downloading from PyPI through pip
or easy_install
:
$ pip install log2jsconsole
Assume that your WSGI application name is app
:
from yourapp import app
from log2jsconsole import LoggingMiddleware
app = LoggingMiddleware(app)
Or you can add this as a filter of Python Paste:
[filter:log]
use = egg:log2jsconsole
auto_install = True
Released on June 7, 2013.
- Support for Python Paste filter entry point. [#1 by Roberto De Almeida]
- Fixed incompatibile signature (according to PEP 333) of
start_response
. [#1 by Roberto De Almeida]
Released on November 28, 2011.
- Fixed a bug of
Content-Type
detection.
Released on November 28, 2011.
- Fixed a bug of
Content-Type
detection.
Initially released on November 26, 2011.