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.2
Released on June 22, 2017.
Fixed a ValueError raised when a log record with {'user_waiting': Flase} is made without any previous log records with {'user_waiting': True}.
Version 0.2.1
Released on May 21, 2017.
Fixed a bug that SpinerHandler had crashed when user_waiting log records show a spinner again after a previous spinner was hidden.
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.
Metadata
Release files for logging-spinner 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logging-spinner-0.2.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logging_spinner-0.2.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / logging-spinner-0.2.2.tar.gz
| Download URL | logging-spinner-0.2.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d31ce3399a6f2aa87f72f90e8cacbdcb470ffbeeb33fc1bce084526ddd3e6e16
|
|
BLAKE2b-256 checksum How to use checksums |
e8e6b2cf8e992323ae9313cfea9be3fa10c07207052f19194f150555997bde27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / logging_spinner-0.2.2-py2.py3-none-any.whl
| Download URL | logging_spinner-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5371342fbd5aa498bd7de81f158b032c1a611b219d2e324d7cdecaaf3f0b0bea
|
|
BLAKE2b-256 checksum How to use checksums |
2bf373f854648cad03e23fdb0b6bbff293f2173d28f36839d65bc2315bec0533
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |