log-indented gives you human-friendly logs.
Project description
log-indented
This package helps you and your code produce indented, human-friendly, easy to understand logs.
Executing count_barnyard_animals()
in this code example:
from log_indented import logged, log_info
@logged(logger)
def count_chicken() -> int:
return 3
@logged(logger)
def count_ducks() -> int:
return 7
@logged(logger)
def count_birds() -> int:
return count_chicken() + count_ducks()
@logged(logger)
def count_goats() -> int:
return 7
@logged(logger)
def count_sheep() -> int:
return 0
@logged(logger)
def count_barnyard_animals() -> int:
total_animal_count: int = count_birds() + count_goats() + count_sheep()
log_info(f"total barnyard animals: {total_animal_count}")
return total_animal_count
will produce output similar to this:
+ count_barnyard_animals: enter
+ count_birds: enter
+ count_chicken: enter
- count_chicken: exit. took 0.00 ms.
+ count_ducks: enter
- count_ducks: exit. took 0.00 ms.
- count_birds: exit. took 0.07 ms.
+ count_goats: enter
- count_goats: exit. took 0.00 ms.
+ count_sheep: enter
- count_sheep: exit. took 0.00 ms.
count_barnyard_animals: total barnyard animals: 17
- count_barnyard_animals: exit. took 0.18 ms.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
log_indented-0.4.5.tar.gz
(6.1 kB
view details)
Built Distribution
File details
Details for the file log_indented-0.4.5.tar.gz
.
File metadata
- Download URL: log_indented-0.4.5.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8811c9b7901dba1bf52b583acea5320eb94dc7ded5a11cf6c1b30dd525ec173 |
|
MD5 | db6dab986e774bae8bf078d523ad99dc |
|
BLAKE2b-256 | fca3dc7c3a0bebf11f70d3495cc65f997ae27536b25341175245f129c85ca1be |
File details
Details for the file log_indented-0.4.5-py3-none-any.whl
.
File metadata
- Download URL: log_indented-0.4.5-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0741f2a5e25f6ad2d98005bd2fdb08696b75ab17ce48219ea911c16224ceea2 |
|
MD5 | 734124d0abf3c8491060878c957cb906 |
|
BLAKE2b-256 | 0fb1a8bfc0ebcbbe16f936ad6e2fdfdd3a033f4ad5ce18bc0517fe102efb5978 |