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.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
logging-spinner-0.1.0.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for logging_spinner-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 023557506e0dbcfc9e9e114dcb62271457a43df47ef0a60e3199a38a536b9c94 |
|
MD5 | 4b19a1c8357c18c3648242a08de0b8ef |
|
BLAKE2b-256 | 0fd10117e533841a39f47e711d6d0d711f6ed9064b832c8277f2fe0cdd000254 |