Non-intrusive spinner through standard logging library
Project description
This library helps to display loading spinners in CLI in non-intrusive manner. Applications/libraries don’t have to depend on any third-party API, but only need to log loading messages through Python’s standard logging library:
logger = logging.getLogger('myapp.logger')
logger.info('Loading data...', extra={'user_waiting': True})
# some long taking process goes here...
logger.info('Finished loading!', extra={'user_waiting': False})
At the outest code of the application, setup a SpinnerHandler:
from logging_spinner import SpinnerHandler
logger = logging.getLogger('myapp')
logger.setLevel(logging.INFO)
logger.addHandler(SpinnerHandler())
SpinnerHandler is only aware of log records with user_waiting extra field and displays them with a spinner.
See also sample.py code.
Changelog
Version 0.2.0
Released on May 21, 2017.
logging_spinner.UserWaitingFilter was introduced to avoid duplicate prints of a log record with user_waiting extra field.
Version 0.1.0
Released on May 21, 2017. The initial release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file logging-spinner-0.2.0.tar.gz
.
File metadata
- Download URL: logging-spinner-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69a31295ed70008173bfed6b441460dc6c70a3e2c8b924d4ec9f0c50a7ce4101 |
|
MD5 | 16d73cefe3e27713308b6a60d7badf5b |
|
BLAKE2b-256 | ec113d760fd347fefaaa70ceeb623bd4d3e0c92afd7792266346b5e44bfc3460 |
File details
Details for the file logging_spinner-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: logging_spinner-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48109b55b8c4c3aecfb083109dd9629c307a40f798fb9405e81406bb28be5b21 |
|
MD5 | e1d7c601b4e7c03390f7c33c4b458557 |
|
BLAKE2b-256 | 74cca2abe16c73501384e8bf9506057181e89c99493668a6ef0de831c571f0b9 |