# HG changeset patch # User Andy Todd # Date 1678261427 -39600 # Wed Mar 08 18:43:47 2023 +1100 # Node ID 3e94588dbf58004f0dcbd3e21aa693f154eabc2a # Parent 7c253482951c6312a5cf1b9748268044505fd824 Bumped version to 0.0.4, updated documentation and published to pypi diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Simple Logging =============================== -* version number: 0.0.3 -* date: 2023.02.10 +* version number: 0.0.4 +* date: 2023.03.08 * author: Andrew J. Todd esq. Overview @@ -18,11 +18,12 @@ $ pip install simple_log -Or clone the repo: +Or clone the repo:: $ hg clone https://hg.sr.ht/~andy47/simple_log $ python setup.py install + Usage ----- @@ -69,4 +70,4 @@ Contributing ------------ -If you would like to contribute please visit the project web site at - https://hg.sr.ht/~andy47/simple_log +If you would like to contribute please visit the project web site at - https://hg.sr.ht/~andy47/simple_log \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -53,7 +53,7 @@ # General information about the project. project = 'Simple Log' -copyright = '2017, Andrew J. Todd esq' +copyright = '2023, Andrew J. Todd esq' author = 'Andy Todd' # The version info for the project you're documenting, acts as replacement for @@ -61,9 +61,9 @@ # built documents. # # The short X.Y version. -version = '0.0.2' +version = '0.0.4' # The full version, including alpha/beta/rc tags. -release = '0.0.2' +release = '0.0.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -115,7 +115,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = 'classic' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/source/simplelog.rst b/docs/source/simplelog.rst --- a/docs/source/simplelog.rst +++ b/docs/source/simplelog.rst @@ -43,6 +43,10 @@ >>> my_log.debug('This is the second debug message') 2016.11.10 22:34:55 test_log DEBUG:: This is the second debug message +----------------- +Writing to a file +----------------- + If you would like your log messages written to a file as well as the screen use the ``add_file`` function >>> from simple_log import get_log, add_file @@ -65,13 +69,13 @@ >>> cat test_log.log 2016.11.23 19:54:10 test_log INFO:: Information message to file ---- +------------------ Structured logging ---- +------------------ This module now includes support for structured logging using the approach described in the `logging cookbook`_ -We have included a class which can be used to wrap messages sent to the `info`, `error` or `warn` logging methods to present +We have included a class which can be used to wrap messages sent to any of the logging methods that will present the output as a Json object. In keeping with the rest of the module this is designed to be simple to use >>> from simple_log import get_log, StructuredMessage as sm @@ -96,9 +100,10 @@ The structured message class has increased this to also include the :py:mod:`json` module as well. -This package is made up of one Python module called ``log_utilities.py`` within the ``simple_log`` module. It has two functions +This package is made up of one Python module called ``log_utilities.py`` within the ``simple_log`` module. It has these members .. autofunction:: simple_log.get_log .. autofunction:: simple_log.add_file +.. autofunction:: simple_log.StructuredMessage \ No newline at end of file diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from codecs import open from os import path -__version__ = '0.0.3' +__version__ = '0.0.4' here = path.abspath(path.dirname(__file__)) diff --git a/simple_log/log_utilities.py b/simple_log/log_utilities.py --- a/simple_log/log_utilities.py +++ b/simple_log/log_utilities.py @@ -5,7 +5,7 @@ Licensed under the MIT license - https://opensource.org/licenses/MIT """ -__version__ = (0, 0, 3) +__version__ = (0, 0, 4) __date__ = (2016, 11, 11) __author__ = "Andrew J Todd esq. " @@ -18,6 +18,10 @@ logs = {} class StructuredMessage: + """Present the logging message and arguments in a structured format + + Any keyword arguments will be returned as a json object. + """ def __init__(self, message, /, **kwargs): self.message = message self.kwargs = kwargs