Customizable log formatter that supports recursive log sections
Project description
fslog
fslog is a tool that helps formatting nested and structured logs.
Example
import fslog
def fact(n):
if n == 1:
fslog.log("Reached base case")
return 1
fslog.open(f"Computing fact({n})")
fslog.log(f"Recursive step: {n} * fact({n-1})")
res = n * fact(n-1)
fslog.close(f"fact({n})={res}")
return res
fslog.param["open.style"] = fslog.style.BOLD + fslog.style.YELLOW
fslog.param["log.style"] = fslog.style.UNDERLINE
fslog.param["close.style"] = fslog.style.GREEN
fact(4)
Will produce the following output:
┌─Computing fact(4)
│ Recursive step: 4 * fact(3)
│ ┌─Computing fact(3)
│ │ Recursive step: 3 * fact(2)
│ │ ┌─Computing fact(2)
│ │ │ Recursive step: 2 * fact(1)
│ │ │ Reached base case
│ │ └─fact(2)=2
│ └─fact(3)=6
└─fact(4)=24
Try it on your terminal!
Others
horatio is a project that uses fslog. Go take a look!
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
fslog-0.1.3.tar.gz
(2.2 kB
view details)
File details
Details for the file fslog-0.1.3.tar.gz.
File metadata
- Download URL: fslog-0.1.3.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9ca3acbc4dc09c82e3a366efdbef0a4af3af82214d1b6e07c1f15b56b6817b
|
|
| MD5 |
639226633b35efc9c97313d7269472a7
|
|
| BLAKE2b-256 |
e5f2618ba3ddd1d394059fdf996c5ee8c6c3a55c258c63e95366244007c26482
|