Package: jk-asyncio-logging
jk_asyncio_loggingIntroductionThis python module ...Information about this module can be found here:github.orgpypi.python.orgWhy this module?Withjk_loggingthere is a logging module available that allows constructing loggers from a JSON based description, offers buffers for log messages and supports hierarchical logging. Unfortunately this particular module is synchroneous and therefore can not be used inAsynciodirectly. This implementation therefore wrapsjk_loggingand provides an API usable inAsyncio.Limitations of this moduleThis module provides classes wrapping (almost all) classes fromjk_logging. It provides almost all functionality despite one: Descending hierarchically is not supported. (This might change one day, but not in the near future.)How to install moduleThis module can be installed easily usingpip.Use this command for a system wide installation of this module:$sudopipinstalljk-asyncio-loggingUse this command for user specific installation of this module:$pipinstall--userjk-asyncio-loggingThe PiPy module is always kept in sync with the Github repository so using PyPi is equivalent to a manual installation using the code provided on Github.How to use this moduleImport this modulePlease include this module into your application using the following code:importjk_asyncio_loggingConstruct a loggerExample:log=jk_asyncio_logging.AsyncioConsoleLogger.create(logMsgFormatter=jk_asyncio_logging.COLOR_LOG_MESSAGE_FORMATTER)Here we construct a console logger (which is an object that writes log messages to STDOUT.) It is configured for using colors for all output here.Use the loggerYou can create text based log messages and write them to the logger. Example:awaitlog.debug("This is a test for DEBUG.")awaitlog.notice("This is a test for NOTICE.")awaitlog.info("This is a test for INFO.")awaitlog.warning("This is a test for WARNING.")awaitlog.error("This is a test for ERROR.")Exceptions can be logged as well. Example:try:awaitlog.notice("Let's try a calculation that will fail ...")a=0b=5/aexceptExceptionasee:awaitlog.error(ee)What kind of log objects are available?You can make use of the following log objects:AsyncioBufferLogger- implements a buffer for log messages, which later on can be forwareded to another loggerAsyncioConsoleLogger- implements writing to STDOUTAsyncioFileLogger- implements writing to a fileAsyncioFilterLogger- implements filtering of log messages according to log levelAsyncioMulticastLogger- implements forwarding log messages to multiple loggersAsyncioNamedMulticastLogger- implements forwarding log messages to multiple loggersAsyncioNullLogger- discards all log messagesAsyncioStringListLogger- implements a buffer for log messages, where all log messages are stored a plain text stringsFurther ReadingSee thetestdirectory for detailed examples of all loggers.Contact InformationThis is Open Source code. That not only gives you the possibility of freely using this code it also
allows you to contribute. Feel free to contact the author(s) of this software listed below, either
for comments, collaboration requests, suggestions for improvement or reporting bugs:Jürgen Knauth:jknauth@uni-goettingen.de,pubsrc@binary-overflow.deLicenseThis software is provided under the following license:Apache Software License 2.0