fslog


Namefslog JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttp://github.com/fsossai/fslog
SummaryCustomizable log formatter that supports recursive log sections
upload_time2023-12-06 22:23:23
maintainer
docs_urlNone
authorFederico Sossai
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fslog

`fslog` is a tool that helps formatting nested and structured logs.

## Example

```python
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`](https://github.com/fsossai/horatio) is a project that uses fslog. Go take a look!

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/fsossai/fslog",
    "name": "fslog",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Federico Sossai",
    "author_email": "federico.sossai@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e5/f2/618ba3ddd1d394059fdf996c5ee8c6c3a55c258c63e95366244007c26482/fslog-0.1.3.tar.gz",
    "platform": null,
    "description": "# fslog\n\n`fslog` is a tool that helps formatting nested and structured logs.\n\n## Example\n\n```python\nimport fslog\n\ndef fact(n):\n    if n == 1:\n        fslog.log(\"Reached base case\")\n        return 1\n    fslog.open(f\"Computing fact({n})\")\n    fslog.log(f\"Recursive step: {n} * fact({n-1})\")\n    res = n * fact(n-1)\n    fslog.close(f\"fact({n})={res}\")\n    return res\n\nfslog.param[\"open.style\"] = fslog.style.BOLD + fslog.style.YELLOW\nfslog.param[\"log.style\"] = fslog.style.UNDERLINE\nfslog.param[\"close.style\"] = fslog.style.GREEN\n\nfact(4)\n```\nWill produce the following output:\n```\n\u250c\u2500Computing fact(4)\n\u2502 Recursive step: 4 * fact(3)\n\u2502 \u250c\u2500Computing fact(3)\n\u2502 \u2502 Recursive step: 3 * fact(2)\n\u2502 \u2502 \u250c\u2500Computing fact(2)\n\u2502 \u2502 \u2502 Recursive step: 2 * fact(1)\n\u2502 \u2502 \u2502 Reached base case\n\u2502 \u2502 \u2514\u2500fact(2)=2\n\u2502 \u2514\u2500fact(3)=6\n\u2514\u2500fact(4)=24\n```\nTry it on your terminal!\n\n## Others\n\n[`horatio`](https://github.com/fsossai/horatio) is a project that uses fslog. Go take a look!\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Customizable log formatter that supports recursive log sections",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "http://github.com/fsossai/fslog"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e5f2618ba3ddd1d394059fdf996c5ee8c6c3a55c258c63e95366244007c26482",
                "md5": "639226633b35efc9c97313d7269472a7",
                "sha256": "6b9ca3acbc4dc09c82e3a366efdbef0a4af3af82214d1b6e07c1f15b56b6817b"
            },
            "downloads": -1,
            "filename": "fslog-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "639226633b35efc9c97313d7269472a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2197,
            "upload_time": "2023-12-06T22:23:23",
            "upload_time_iso_8601": "2023-12-06T22:23:23.472240Z",
            "url": "https://files.pythonhosted.org/packages/e5/f2/618ba3ddd1d394059fdf996c5ee8c6c3a55c258c63e95366244007c26482/fslog-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-06 22:23:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fsossai",
    "github_project": "fslog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "fslog"
}
        
Elapsed time: 0.17024s