Spinner Logger for Python
Project description
spinlog.py
Spinner Logger for Python
Installation
Just pip install spinlog
and you can use it.
Usage
Spinlog is build on top of halo providing a different API to interact with the spinner.
Basic Usage
from spinlog import Spinner
from time import sleep
print("About to launch Spinner")
with Spinner.get("I'm spinning around") as s:
sleep(2)
s.info("Here is an info message while spinning around")
# you can use s.warn, s.error, or s.debug
sleep(2)
print("Spinning Over")
Advanced usage
Spinlog is build in such a manner that you can disable the spinning animation and replace it with proper logging without having to change the codebase.
This is done by creating a spinner instance, potentialy configured with two logger,
the concommitant_logger
to be run alongside the spinner (for logging to file for instance),
and the alternative_logger
to replace spinner animation and logging.
A complete example can be found in the examples folder Here is an except:
# imports and logger definitions
should_spin = "--no-spin" not in sys.argv
# Configure spinner
spinner = Spinner(spinner="triangle", is_spinning=should_spin,
alternative_logger=stream_logger, concommitant_logger=file_logger)
# Use spinner
with spinner("Operation in progress") as s:
sleep(2)
s.info("Checkpoint reached")
sleep(2)
Licence
MIT © AdrieanKhisbe
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 spinlog-0.3.0.tar.gz
.
File metadata
- Download URL: spinlog-0.3.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a260cac732f3dd381bcf24e765bc0cb387ce16cc2d41f8313b0350c5e5417355 |
|
MD5 | 3765a7b2a54d3aeb654988a00dc09a5f |
|
BLAKE2b-256 | b4f63e6c2119cc69a99179cfdd0e3304e9cbeceb1a807724c9c3a2de157279db |
File details
Details for the file spinlog-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: spinlog-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50334fbefdc9fca2e7cec65df689ecbd9baeee7d88faaee8a80447e812381ba4 |
|
MD5 | 32a4469c66d487ccc5ec1095eaf61dfc |
|
BLAKE2b-256 | a1160cafe5876611a5a02a12e82196661602587047221ea50f9205d5c6f30f9d |