This logger offers some conveniences that make easier of logging from python code and from ZPT templates.
Project description
Overview
This is logger written from scratch. It offers few conveniences that helps in logging (e.g.: logging exceptions). It can also log some messages from ZPT (Zope Page Templates).
Using
stxnext.log can be opened by used in python code:
>>> from stxnext.log import log >>> log('log <this> text') >>> log('log another text', printit=True) #doctest:+ELLIPSIS [...] log another text >>> try: ... 1/0 ... except ZeroDivisionError, e: ... log.log_exc(e) ... >>> log.getLoggedTextAsHtml() #doctest:+ELLIPSIS, +NORMALIZE_WHITESPACE <pre>[...] log <this> text...</pre>
stxnext.log can be also used in ZPT templates:
<tal:block tal:define="log context/@@STXNextLogger; result python: log.setFilename('logger_filename.log'); result python: log.setName('logger name');"> <tal:block tal:define="result python: log('log this text')" /> <tal:block tal:define="result python: log('log another text', printit=True)" /> <pre tal:replace="structure log/getLoggedTextAsHtml" /> </tal:block>
Installation
Alternatively, if you are using zc.buildout to manage your project, you can do this:
Add stxnext.log to the list of eggs to install, e.g.:
[buildout] ... eggs = ... stxnext.log
If you’re using plone.recipe.zope2instance recipe to manage your instance add this lines to install a ZCML slug:
[instance] recipe = plone.recipe.zope2instance ... zcml = ... stxnext.log
If you’re using zc.zope3recipes:application recipe to manage your instance add this lines to install a ZCML slug:
[instance] recipe = zc.zope3recipes:application ... site.zcml = ... <include package="stxnext.log" />
Re-run buildout, e.g. with:
$ ./bin/buildout
You can skip the ZCML slug if you are going to explicitly include the package from another package’s configure.zcml file.
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stxnext.log-0.2.0.tar.gz
.
File metadata
- Download URL: stxnext.log-0.2.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fd4a53fc3190b9dd52ca351bb03924cb3f2f1df97a8324dbfe9f6744fc1d857 |
|
MD5 | 1bcdd34c0ed6da160a280104e53b8159 |
|
BLAKE2b-256 | 5146b253ea92c7451ee771aedb3b452bc0a2499ebe9e4032ea777d2542ee9c61 |
File details
Details for the file stxnext.log-0.2.0-py2.4.egg
.
File metadata
- Download URL: stxnext.log-0.2.0-py2.4.egg
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d5cbeda6b766595c9809e5bf4103a4499bf2b4ef7a8d97a6766ecacabe0a6ab |
|
MD5 | 67198bc18f910adfdfe16a9feaad73c6 |
|
BLAKE2b-256 | bd0a160039c7727b3c0fc055fa08d79946dce5aec23f2b677b8a8f68318bc3a3 |