Skip to main content

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!

Metadata

Release files for fslog 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fslog 0.1.3
File Size Uploaded
fslog-0.1.3.tar.gz 2.2 kB Details

Release files / fslog-0.1.3.tar.gz

Download URL fslog-0.1.3.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6b9ca3acbc4dc09c82e3a366efdbef0a4af3af82214d1b6e07c1f15b56b6817b
BLAKE2b-256 checksum
How to use checksums
e5f2618ba3ddd1d394059fdf996c5ee8c6c3a55c258c63e95366244007c26482
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page