M .hgignore +2 -0
@@ 1,6 1,7 @@
syntax: glob
.idea
.pypirc
+.pytest_cache
docs/build
build
dist
@@ 8,3 9,4 @@ simple_log.egg-info
.DS_Store
*.pyc
*.log
+*.swp
M README.md +12 -17
@@ 1,15 1,14 @@
Simple Logging
===============================
-* version number: 0.0.2
-* date: 2016.11.23
+* version number: 0.0.3
+* date: 2023.02.10
* author: Andrew J. Todd esq.
Overview
--------
-A python module to allow you to log. It's a wrapper around the standard logging module with sensible defaults and
-as little configuration as possible. Documentation is on [halfcooked.com](https://halfcooked.com/code/simple_log/)
+A python module to allow you to log with minimal fuss. It's a wrapper around the standard logging module with sensible defaults and as little configuration as possible. Documentation is on [halfcooked.com](https://halfcooked.com/code/simple_log/)
Installation
------------
@@ 32,21 31,18 @@ We try and stay true to the name and mak
>>> from simple_log import get_log
>>> my_log = get_log()
>>> my_log.info("This is an information message")
- 2016.11.10 22:21:51 INFO:: This is an information message
+ 2016.11.10 22:21:51 default INFO:: This is an information message
If you want to have multiple logs just pass a name to `get_log`
>>> first_log = get_log("first")
>>> first_log.info("Information message to first log")
- 2016.11.10 22:27:30 INFO:: Information message to first log
+ 2016.11.10 22:27:30 first INFO:: Information message to first log
>>> second_log = get_log("two")
>>> second_log.debug("This is a debug message")
- 2016.11.10 22:28:02 DEBUG:: This is a debug message
+ 2016.11.10 22:28:02 two DEBUG:: This is a debug message
-By default the logging level is set to `'INFO'` (the standard module defaults to `'WARNING'`). See the
-[logging tutorial](https://docs.python.org/3/howto/logging.html#logging-basic-tutorial) for information on logging
-levels. If you would like to change the logging level, for instance to display 'DEBUG' messages use the `setLevel`
-method on your log object
+By default the logging level is set to `'INFO'` (the standard module defaults to `'WARNING'`). See the [logging tutorial](https://docs.python.org/3/howto/logging.html#logging-basic-tutorial) for information on logging levels. If you would like to change the logging level, for instance to display 'DEBUG' messages use the `setLevel` method on your log object
>>> from simple_log import get_log
>>> my_log = get_log('test_log')
@@ 54,22 50,21 @@ method on your log object
...
>>> my_log.setLevel('DEBUG')
>>> my_log.debug('This is the second debug message')
- 2016.11.10 22:34:55 DEBUG:: This is the second debug message
+ 2016.11.10 22:34:55 test_log DEBUG:: This is the second debug message
-The log level values that you can pass to `setLevel` are `'DEBUG'`, `'INFO'` (the default), `'WARNING'`, `'ERROR'` or
-`'CRITICAL'`.
+The log level values that you can pass to `setLevel` are `'DEBUG'`, `'INFO'` (the default), `'WARNING'`, `'ERROR'` or `'CRITICAL'`.
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
>>> my_log = get_log('test_log')
>>> my_log.info('This is an information message')
- 2016.11.12 22:48:10 INFO:: This is an information message
+ 2016.11.12 22:48:10 test_log INFO:: This is an information message
>>> add_file('test_log', 'test_log.log')
>>> my_log.info('This is another information message')
- 2016.11.12 22:49:30 INFO:: This is another information message
+ 2016.11.12 22:49:30 test_log INFO:: This is another information message
>>> cat test_log.log
- 2016.11.12 22:49:30 INFO:: This is another information message
+ 2016.11.12 22:49:30 test_log INFO:: This is another information message
Contributing
------------
M docs/source/distributing.rst +1 -1
@@ 16,4 16,4 @@ 3. Upload to pypi::
Or use twine::
- $ twine upload -r pypi dist/*
No newline at end of file
+ $ twine upload -r pypi dist/*
M docs/source/simplelog.rst +12 -14
@@ 18,24 18,22 @@ We try and stay true to the name and mak
>>> from simple_log import get_log
>>> my_log = get_log()
>>> my_log.info("This is an information message")
- 2016.11.10 22:21:51 INFO:: This is an information message
+ 2016.11.10 22:21:51 default INFO:: This is an information message
>>> my_log.error("This is an error message")
- 2016.11.10 22:22:12 ERROR:: This is an error message
+ 2016.11.10 22:22:12 default ERROR:: This is an error message
>>> my_log.warning("This is a warning message")
- 2016.11.10 23:29:14 WARNING:: This is a warning message
+ 2016.11.10 23:29:14 default WARNING:: This is a warning message
If you want to have multiple logs just pass a name to `get_log`
>>> first_log = get_log("first")
>>> first_log.info("Information message to first log")
- 2016.11.10 22:27:30 INFO:: Information message to first log
+ 2016.11.10 22:27:30 first INFO:: Information message to first log
>>> second_log = get_log('two')
>>> second_log.debug("This is a debug message")
- 2016.11.10 22:28:02 DEBUG:: This is a debug message
+ 2016.11.10 22:28:02 two DEBUG:: This is a debug message
-By default the logging level is set to ``INFO`` (the standard module defaults to ``WARNING``). See the
-`logging tutorial <https://docs.python.org/3/howto/logging.html#logging-basic-tutorial>`_ for information on logging
-levels. If you would like to change the logging level, for instance to display ``DEBUG`` messages use the ``setLevel`` method on your log object
+By default the logging level is set to ``INFO`` (the standard module defaults to ``WARNING``). See the `logging tutorial <https://docs.python.org/3/howto/logging.html#logging-basic-tutorial>`_ for information on logging levels. If you would like to change the logging level, for instance to display ``DEBUG`` messages use the ``setLevel`` method on your log object
>>> from simple_log import get_log
>>> my_log = get_log('test_log')
@@ 43,19 41,19 @@ levels. If you would like to change the
...
>>> my_log.setLevel('test_log', 'DEBUG')
>>> my_log.debug('This is the second debug message')
- 2016.11.10 22:34:55 DEBUG:: This is the second debug message
+ 2016.11.10 22:34:55 test_log DEBUG:: This is the second debug message
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
>>> my_log = get_log('test_log')
>>> my_log.info('This is an information message')
- 2016.11.12 22:48:10 INFO:: This is an information message
+ 2016.11.12 22:48:10 test_log INFO:: This is an information message
>>> add_file('test_log', 'test_log.log')
>>> my_log.info('This is another information message')
- 2016.11.12 22:49:30 INFO:: This is another information message
+ 2016.11.12 22:49:30 test_log INFO:: This is another information message
>>> cat test_log.log
- 2016.11.12 22:49:30 INFO:: This is another information message
+ 2016.11.12 22:49:30 test_log INFO:: This is another information message
the ``add_file`` function tries to be clever and should work if you pass it either the name of a log that was created using ``get_log`` or if you pass in the log object itself.
@@ 63,9 61,9 @@ the ``add_file`` function tries to be cl
>>> my_log = get_log('test_log')
>>> add_file(my_log, 'test_log.log')
>>> my_log.info('Information message to file')
- 2016.11.23 19:54:10 INFO:: Information message to file
+ 2016.11.23 19:54:10 test_log INFO:: Information message to file
>>> cat test_log.log
- 2016.11.23 19:54:10 INFO:: Information message to file
+ 2016.11.23 19:54:10 test_log INFO:: Information message to file
Code Structure
--------------
M setup.py +3 -3
@@ 2,7 2,7 @@ from setuptools import setup, find_packa
from codecs import open
from os import path
-__version__ = '0.0.2'
+__version__ = '0.0.3'
here = path.abspath(path.dirname(__file__))
@@ 22,8 22,8 @@ setup(
version=__version__,
description='A python module with sensible defaults for logging',
long_description=long_description,
- url='https://bitbucket.org/andy47/simplelog',
- download_url='https://bitbucket.org/andy47/simplelog/downloads/',
+ url='https://hg.sr.ht/~andy47/simple_log',
+ # download_url='https://bitbucket.org/andy47/simplelog/downloads/',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',