log-indented gives you humani-friendly logs.
Project description
log-indented
This is a package for producing indented, human-friendly, easy to understand logs.
Example:
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.1.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for log_indented-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c0ba5fa9e7c7d38c63267d71819c90a06a699b0d76cff475992829c3f0caf9 |
|
MD5 | baf464798cc9419a46bf80e7bd6f9d82 |
|
BLAKE2b-256 | 6d0927b38cd1fdb7a67b6dd59db22eb1e5e61da9304edbb24d5fb7ac6dd15b73 |