{ "info": { "author": "J\u00fcrgen Knauth", "author_email": "pubsrc@binary-overflow.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing", "Topic :: System :: Logging" ], "description": "jk_logging\n==========\n\nIntroduction\n------------\n\nThis python module provides a logging infrastructure. It contains various classes to implement logging and aid in debugging.\n\nInformation about this module can be found here:\n\n* [github.org](https://github.com/jkpubsrc/python-module-jk-logging)\n* [pypi.python.org](https://pypi.python.org/pypi/jk_logging)\n\nHow to use this module\n----------------------\n\n\n\n\n\nBasic Architecture\n------------------\n\nDocumentation of Log Objects\n----------------------------\n\nIn order to use loggers you need to know which classes there are end what kind of methods they offer for use. The next subchapters\nwill provide you with that information.\n\n### Common Methods\n\nEvery log object will provide the following methods for use:\n\n```python\n#\n# Perform logging with log level DEBUG.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef debug(self, text)\n```\n\n```python\n#\n# Perform logging with log level NOTICE.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef notice(self, text)\n```\n\n```python\n#\n# Perform logging with log level INFO.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef info(self, text)\n```\n\n```python\n#\n# Perform logging with log level STDOUT.\n# This method is intended to be used in conjunction with STDOUT handlers.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef stdout(self, text)\n```\n\n```python\n#\n# Perform logging with log level WARNING.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef warning(self, text)\n```\n\n```python\n#\n# Perform logging with log level ERROR.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef error(self, text)\n```\n\n```python\n#\n# Perform logging with log level STDERR.\n# This method is intended to be used in conjunction with STDERR handlers.\n#\n# @param\tstring text\t\tThe text to write to this logger.\n#\ndef stderr(self, text)\n```\n\n```python\n#\n# Perform logging with log level EXCEPTION.\n#\n# @param\tException exception\t\tThe exception to write to this logger.\n#\ndef exception(self, exception)\n```\n\n```python\n#\n# If this logger is buffering log messages, clear all log messages from this buffer.\n# If this logger has references to other loggers, such as a FilterLogger\n# or a MulticastLogger\n#\ndef clear(self)\n```\n\nOther log objects will provide additional methods.\n\n### `BufferLogger`\n\nObjects of type `BufferLogger` will provide the following additional methods:\n\n```python\n#\n# Return a list of strings that contains the data stored in this logger.\n# Standard formatting is used for output.\n#\n# @return\t\tstring[]\t\tReturns an array of strings ready to be written to the console or a file.\n#\ndef getBufferDataAsStrList(self)\n```\n\n```python\n#\n# Return a list of tuples that contains the data stored in this logger.\n#\n# @return\t\ttuple[]\t\tReturns an array of tuples. Each tuple will contain the following fields:\n#\t\t\t\t\t\t\t* int timeStamp : The time stamp since Epoch in seconds.\n#\t\t\t\t\t\t\t* EnumLogLevel logLevel : The log level of this log entry.\n#\t\t\t\t\t\t\t* string|Exception textOrException : A log message or an execption object.\n#\ndef getBufferDataAsTupleList(self)\n```\n\n```python\n#\n# Return a single string that contains the data stored in this logger.\n# Standard formatting is used for output.\n#\n# @return\t\tstring\t\tReturns a single string ready to be written to the console or a file.\n#\ndef getBufferDataAsStr(self)\n```\n\n```python\n#\n# Forward the log data stord in this logger to another logger.\n#\n# @param\t\tAbstractLogger logger\t\t\tAnother logger that will receive the log data.\n#\ndef forwardTo(self, logger, bClear = False)\n```\n\nInstantiation Based on Configuration Information Provided\n---------------------------------------------------------\n\nOften it is convenient for applications to provide some detailed way of specifying how data should be logged. For exactly that reason\nthis logging framework provides a function that is capable of creating loggers from some kind of description. Example:\n\n```python\nimport jk_logging\n\nlogger = jk_logging.instantiate({\n\t\"type\": \"MulticastLogger\",\n\t\"nested\": [\n\t\t{\n\t\t\t\"type\": \"ConsoleLogger\"\n\t\t},\n\t\t{\n\t\t\t\"type\": \"FileLogger\",\n\t\t\t\"filePath\": \"mylogfile-%Y-%m-%d.log\",\n\t\t\t\"rollOver\": \"day\"\n\t\t}\n\t]\n})\n```\n\n(more description comeing soon)\n\nExamples\n--------\n\nHere is some example code that demonstrates the use of the various loggers available:\n\n```python\nprint()\nprint(\"-- ConsoleLogger --\")\nprint()\n\nclog = ConsoleLogger()\n\nclog.debug(\"This is a test for DEBUG.\")\nclog.notice(\"This is a test for NOTICE.\")\nclog.info(\"This is a test for INFO.\")\nclog.warning(\"This is a test for WARNING.\")\nclog.error(\"This is a test for ERROR.\")\n\nprint()\nprint(\"-- Exception Handling --\")\nprint()\n\ndef produceError():\n\ta = 5\n\tb = 0\n\tc = a / b\n\ntry:\n\tclog.notice(\"Now let's try a calculation that will fail ...\")\n\tproduceError()\nexcept Exception as ee:\n\tclog.error(ee)\n\nprint()\nprint(\"-- FilterLogger --\")\nprint()\n\nflog = FilterLogger(clog, EnumLogLevel.WARNING)\n\nflog.notice(\"This message will not appear in the log output.\")\nflog.error(\"This message will appear in the log output.\")\n\nprint()\nprint(\"-- DetectionLogger --\")\nprint()\n\ndlog = DetectionLogger(clog)\ndlog.notice(\"A notice.\")\ndlog.debug(\"A debug message.\")\ndlog.info(\"An informational message.\")\ndlog.debug(\"Another debug message.\")\nprint(dlog.getLogMsgCountsStrMap())\nprint(\"Do we have debug messages? Answer: \" + str(dlog.hasDebug()))\nprint(\"Do we have error messages? Answer: \" + str(dlog.hasError()))\n\nprint()\nprint(\"-- BufferLogger --\")\nprint()\n\nblog = BufferLogger()\nblog.info(\"First we write something to a buffer.\")\nblog.info(\"And something more.\")\nblog.notice(\"And more.\")\nblog.debug(\"And even more.\")\nblog.info(\"Then we write it to the console by forwarding the data to another logger.\")\nblog.forwardTo(clog)\n\nprint()\nprint(\"-- MulticastLogger --\")\nprint()\n\nmlog = MulticastLogger([ clog, clog ])\nmlog.info(\"This message gets written twice.\")\n\nprint()\nprint(\"-- NamedMulticastLogger --\")\nprint()\n\nnmlog = NamedMulticastLogger()\nnmlog.addLogger(\"log1\", clog)\nnmlog.addLogger(\"log2\", clog)\nnmlog.info(\"This message gets written twice.\")\nnmlog.removeLogger(\"log1\")\nnmlog.info(\"This message gets written once.\")\n\nprint()\nprint(\"-- SimpleFileLogger --\")\nprint()\n\nfilelog = SimpleFileLogger(\"test.log\")\nfilelog.info(\"Perform log output to this file logger.\")\nfilelog.close()\n\nfilelog = SimpleFileLogger(\"test.log\")\nfilelog.info(\"Perform more log output to this file logger.\")\nfilelog.close()\n```\n\nThings to do\n------------\n\nAny help in implementing additional log classes and improving on the existing ones is appreciated. Feel free to contact me if you are interested in colaborating.\n\nContact Information\n-------------------\n\nThis is Open Source code. That not only gives you the possibility of freely using this code it also\nallows you to contribute. Feel free to contact the author(s) of this software listed below, either\nfor comments, collaboration requests, suggestions for improvement or reporting bugs:\n\n* J\u00fcrgen Knauth: jknauth@uni-goettingen.de, pubsrc@binary-overflow.de\n\nLicense\n-------\n\nThis software is provided under the following license:\n\n* Apache Software License 2.0", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/jkpubsrc/python-module-jk-logging/tarball/0.2019.10.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jkpubsrc/python-module-jk-logging", "keywords": "debugging,logging", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "jk-logging", "package_url": "https://pypi.org/project/jk-logging/", "platform": "", "project_url": "https://pypi.org/project/jk-logging/", "project_urls": { "Download": "https://github.com/jkpubsrc/python-module-jk-logging/tarball/0.2019.10.4", "Homepage": "https://github.com/jkpubsrc/python-module-jk-logging" }, "release_url": "https://pypi.org/project/jk-logging/0.2019.10.4/", "requires_dist": null, "requires_python": "", "summary": "This is a logging framework.", "version": "0.2019.10.4" }, "last_serial": 5927587, "releases": { "0.2017.1.19": [ { "comment_text": "", "digests": { "md5": "d853b8f2685aabccef4d1df268e95a8d", "sha256": "7f0de4b6b95614ce716c00f3678fe21b6a3c85b557bf36aa193be26eefcd528c" }, "downloads": -1, "filename": "jk_logging-0.2017.1.19.tar.gz", "has_sig": false, "md5_digest": "d853b8f2685aabccef4d1df268e95a8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5983, "upload_time": "2017-01-19T01:41:17", "url": "https://files.pythonhosted.org/packages/a6/dd/27225a872172078c71e457f548b4d0627846733d796f11a259b8418bef59/jk_logging-0.2017.1.19.tar.gz" } ], "0.2017.10.11": [ { "comment_text": "", "digests": { "md5": "dcd6aeb6b03b83f18aa181a311ee50b9", "sha256": "8629560a7ecdca9507403ce2a4e75f736a8d8b689fe6379ac5f04c6481bc3418" }, "downloads": -1, "filename": "jk_logging-0.2017.10.11.tar.gz", "has_sig": false, "md5_digest": "dcd6aeb6b03b83f18aa181a311ee50b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16413, "upload_time": "2017-10-11T20:33:44", "url": "https://files.pythonhosted.org/packages/2c/73/fdbc4cfc1b45bb485daf98b2daa32621851e432633f2a5fe44ad9c285cbc/jk_logging-0.2017.10.11.tar.gz" } ], "0.2017.10.12": [ { "comment_text": "", "digests": { "md5": "f84d870bef1af31e0bd4895ae6e7799a", "sha256": "13361ef32326b185513807e0eefba7c614e3286a193f4eeccaa7d1d2de0d26ae" }, "downloads": -1, "filename": "jk_logging-0.2017.10.12.tar.gz", "has_sig": false, "md5_digest": "f84d870bef1af31e0bd4895ae6e7799a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16448, "upload_time": "2017-10-12T19:33:35", "url": "https://files.pythonhosted.org/packages/43/72/ca354ee13f9ea28835a010da561ddfeeb75a32ab5d0910a49426d474501c/jk_logging-0.2017.10.12.tar.gz" } ], "0.2017.10.7": [ { "comment_text": "", "digests": { "md5": "95df3d68372bc61be77a64f4defd4b00", "sha256": "31751004bb5e744cf2d724d3ae592a6dfed54a800c7fb6cc6309c06b530af164" }, "downloads": -1, "filename": "jk_logging-0.2017.10.7.tar.gz", "has_sig": false, "md5_digest": "95df3d68372bc61be77a64f4defd4b00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16258, "upload_time": "2017-10-07T14:50:07", "url": "https://files.pythonhosted.org/packages/01/3d/89b2cfbb6e6fc466c2eb6b8074e923c00d25f647efdaddea0c8d86c0314d/jk_logging-0.2017.10.7.tar.gz" } ], "0.2017.10.8": [ { "comment_text": "", "digests": { "md5": "d4e24e046db047e3f6bebacbfa9ccc89", "sha256": "7421a5ecfe52fa4f797e56ad80cfd4a8cecdf79b2624b39cc686151b4ebcbba7" }, "downloads": -1, "filename": "jk_logging-0.2017.10.8.tar.gz", "has_sig": false, "md5_digest": "d4e24e046db047e3f6bebacbfa9ccc89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16400, "upload_time": "2017-10-08T15:28:18", "url": "https://files.pythonhosted.org/packages/5b/65/e59c8e1f96143b7ad27473ddc43b215df5f2101febffddbda36ddbd6d7a6/jk_logging-0.2017.10.8.tar.gz" } ], "0.2017.10.8.1": [ { "comment_text": "", "digests": { "md5": "288bc0d65b09ffb299e70990b420ae67", "sha256": "985bd6567a12c5a883f8ef9e54f81d92751044648a4cc12591f34e762eca1ca3" }, "downloads": -1, "filename": "jk_logging-0.2017.10.8.1.tar.gz", "has_sig": false, "md5_digest": "288bc0d65b09ffb299e70990b420ae67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16417, "upload_time": "2017-10-08T15:32:44", "url": "https://files.pythonhosted.org/packages/f6/95/487d0d3dbec2eb3df2fc778359a12d469978a403ec7e06b348003f130c1c/jk_logging-0.2017.10.8.1.tar.gz" } ], "0.2017.10.8.2": [ { "comment_text": "", "digests": { "md5": "a9e915dc135ae9c0187a23fa6b6f0866", "sha256": "b6fbabffc69a374a09e5b0c2a7f06a377283eb725c70a735049d39623e645687" }, "downloads": -1, "filename": "jk_logging-0.2017.10.8.2.tar.gz", "has_sig": false, "md5_digest": "a9e915dc135ae9c0187a23fa6b6f0866", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16412, "upload_time": "2017-10-08T15:33:22", "url": "https://files.pythonhosted.org/packages/7e/76/364ed201ecb221ccf59665598d0ff0995c8f44ced6e119c2743c77256300/jk_logging-0.2017.10.8.2.tar.gz" } ], "0.2017.10.8.3": [ { "comment_text": "", "digests": { "md5": "430f52f4dde128bda7dc551d7efd8664", "sha256": "103daf3dca77246ce944851e2cb46caab0d118dc7baa3e2cfb798f5131a3aae9" }, "downloads": -1, "filename": "jk_logging-0.2017.10.8.3.tar.gz", "has_sig": false, "md5_digest": "430f52f4dde128bda7dc551d7efd8664", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16403, "upload_time": "2017-10-08T15:36:29", "url": "https://files.pythonhosted.org/packages/cb/1d/1561797e4e204837946dad279f73350021166e790eb62ffd4e95c32ca700/jk_logging-0.2017.10.8.3.tar.gz" } ], "0.2017.8.31": [ { "comment_text": "", "digests": { "md5": "6582bc258b87b0fb4ca7fa7cc69eaea3", "sha256": "810db7886cdb70a1f6ed2818b15fd3f2f6d540e307ee057e24f4c61a0c7a2beb" }, "downloads": -1, "filename": "jk_logging-0.2017.8.31.tar.gz", "has_sig": false, "md5_digest": "6582bc258b87b0fb4ca7fa7cc69eaea3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16233, "upload_time": "2017-09-14T15:37:10", "url": "https://files.pythonhosted.org/packages/71/f0/9d258e52c98330d5e80454fa0f5efb307f65ee99057f77bc9823c50c0802/jk_logging-0.2017.8.31.tar.gz" } ], "0.2018.12.17": [ { "comment_text": "", "digests": { "md5": "61d6d05cbcc62fc5678ed35a1f1eaf9e", "sha256": "e49bf047738986d7f106e6855e9346f6bf4dbb655f769f975f3fc0b3a9b8229f" }, "downloads": -1, "filename": "jk_logging-0.2018.12.17.tar.gz", "has_sig": false, "md5_digest": "61d6d05cbcc62fc5678ed35a1f1eaf9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16420, "upload_time": "2018-12-17T08:43:31", "url": "https://files.pythonhosted.org/packages/72/e9/2e4ddeabd83c093e7fa91f9b4e93793188f7e691b890952b644cdd944d87/jk_logging-0.2018.12.17.tar.gz" } ], "0.2018.12.28": [ { "comment_text": "", "digests": { "md5": "a03c8149ef57e995d1da6f09f7cbbd2b", "sha256": "0f397da6dfa5025702fe3c9fafae660ce3b1b1941bb76a0471acc74524f93545" }, "downloads": -1, "filename": "jk_logging-0.2018.12.28.tar.gz", "has_sig": false, "md5_digest": "a03c8149ef57e995d1da6f09f7cbbd2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16440, "upload_time": "2019-01-23T11:02:20", "url": "https://files.pythonhosted.org/packages/37/90/6d3c0bf54efc4977428b399959646e318cc2f9f9da793f55ba5f02e3d2f1/jk_logging-0.2018.12.28.tar.gz" } ], "0.2019.10.4": [ { "comment_text": "", "digests": { "md5": "7e5b4ab5d45a96ab74a9655741a697f5", "sha256": "b9552d73489960f5160de6427e08f8998fff2e9285b696fd5fb7459ebb769d6d" }, "downloads": -1, "filename": "jk_logging-0.2019.10.4.tar.gz", "has_sig": false, "md5_digest": "7e5b4ab5d45a96ab74a9655741a697f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25808, "upload_time": "2019-10-04T09:51:19", "url": "https://files.pythonhosted.org/packages/81/8e/9da47b2c848e69e7f44582b9b32fd91aa335c9a62c276204010e32a38f43/jk_logging-0.2019.10.4.tar.gz" } ], "0.2019.9.10": [ { "comment_text": "", "digests": { "md5": "8587fa9650a2bf6c2feb2a977cedafd3", "sha256": "c06d351a71c88376cc4a477f98d5d1bf944706c84659d4ee9e8cd7bd6c816553" }, "downloads": -1, "filename": "jk_logging-0.2019.9.10.tar.gz", "has_sig": false, "md5_digest": "8587fa9650a2bf6c2feb2a977cedafd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21642, "upload_time": "2019-09-10T15:10:29", "url": "https://files.pythonhosted.org/packages/67/b6/9383be842e8386024822a07648616c4fb7dcafd2581da415fa1ebf1c95e6/jk_logging-0.2019.9.10.tar.gz" } ], "0.2019.9.30": [ { "comment_text": "", "digests": { "md5": "8fb9183f2a7f4d66c518dc69c003f3b8", "sha256": "7c9fb120cd8951d3842e63a9e1dd2def82fafb6295f1bceb592403a435fa6231" }, "downloads": -1, "filename": "jk_logging-0.2019.9.30.tar.gz", "has_sig": false, "md5_digest": "8fb9183f2a7f4d66c518dc69c003f3b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25782, "upload_time": "2019-09-30T15:36:47", "url": "https://files.pythonhosted.org/packages/bb/11/7a94ad5c8aae1706456570789ddd3a0ef6ca393b8c11ab698b94eb55da12/jk_logging-0.2019.9.30.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7e5b4ab5d45a96ab74a9655741a697f5", "sha256": "b9552d73489960f5160de6427e08f8998fff2e9285b696fd5fb7459ebb769d6d" }, "downloads": -1, "filename": "jk_logging-0.2019.10.4.tar.gz", "has_sig": false, "md5_digest": "7e5b4ab5d45a96ab74a9655741a697f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25808, "upload_time": "2019-10-04T09:51:19", "url": "https://files.pythonhosted.org/packages/81/8e/9da47b2c848e69e7f44582b9b32fd91aa335c9a62c276204010e32a38f43/jk_logging-0.2019.10.4.tar.gz" } ] }