M README.md +5 -4
@@ 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 @@ To install use pip:
$ 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 @@ If you would like your log messages writ
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
M docs/source/conf.py +4 -4
@@ 53,7 53,7 @@ master_doc = 'index'
# 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 @@ author = 'Andy Todd'
# 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 @@ todo_include_todos = False
# 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
M docs/source/simplelog.rst +9 -4
@@ 43,6 43,10 @@ By default the logging level is set to `
>>> 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 @@ the ``add_file`` function tries to be cl
>>> 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 only dependency for ``simple_log`` i
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
M setup.py +1 -1
@@ 2,7 2,7 @@ from setuptools import setup, find_packa
from codecs import open
from os import path
-__version__ = '0.0.3'
+__version__ = '0.0.4'
here = path.abspath(path.dirname(__file__))
M simple_log/log_utilities.py +5 -1
@@ 5,7 5,7 @@ Written in and tested against Python 3 o
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. <andy47@halfcooked.com>"
@@ 18,6 18,10 @@ DATE_FORMAT = '%Y.%m.%d %T'
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