https://github.com/coal0/backtrack
Simple logging in Python 3.
https://github.com/coal0/backtrack
logger logging
Last synced: 3 months ago
JSON representation
Simple logging in Python 3.
- Host: GitHub
- URL: https://github.com/coal0/backtrack
- Owner: coal0
- License: mit
- Created: 2017-11-26T11:18:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-30T11:58:09.000Z (over 8 years ago)
- Last Synced: 2026-01-02T19:48:48.738Z (6 months ago)
- Topics: logger, logging
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
backtrack
---------
backtrack is a simple logging tool for Python 3.
Features:
* Simple
* MIT licensed
* Supports all file descriptor 'writable' objects.
* Supports colored output
* Supports three useful formatting keys (datetime, unixtime, file)
To install backtrack, run
.. code-block:: shell
pip install backtrack
or
.. code-block:: shell
pip3 install backtrack
Documentation
#############
``configure(file_descriptor=sys.stdout, level=INFO, use_color=False)``:
Set logging options.
Parameters:
* ``file_descriptor``: A file descriptor with a ``write`` method. Defaults to ``sys.stdout``.
* ``level``: An integer (any of 0, 1, 2 for INFO, WARNING and ERROR respectively). Defaults to INFO.
* ``use_color``: Whether or not to use ANSI color codes. Defaults to False.
Returns:
* ``None``
Raises:
* ``RuntimeError`` if ``file_descriptor`` has no ``write`` method.
* ``ValueError`` if ``level`` is not any of INFO, WARNING, ERROR.
|
|
``error(message)``:
Write a level 2 (ERROR) message to the file.
Parameters:
* ``message``: The message to write to the file.
Returns:
* ``None``
|
|
``info(message)``:
Write a level 0 (INFO) message to the file.
Parameters:
* ``message``: The message to write to the file.
Returns:
* ``None``
|
|
``warning(message)``:
Write a level 1 (WARNING) message to the file.
Parameters:
* ``message``: The message to write to the file.
Returns:
* ``None``
|
|
The ``message`` argument passed to the logging functions can contain these formatting keys:
* ``{datetime}``: The date and time as reported by ``time.ctime``.
* ``{unixtime}``: The unix timestamp as reported by ``time.time``.
* ``{file}``: The calling file.