{"id":50934240,"url":"https://github.com/liblaf/logging","last_synced_at":"2026-06-17T07:31:01.525Z","repository":{"id":360266358,"uuid":"1249220895","full_name":"liblaf/logging","owner":"liblaf","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-08T18:01:47.000Z","size":555,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-08T19:14:50.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liblaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://afdian.com/a/liblaf"]}},"created_at":"2026-05-25T13:26:39.000Z","updated_at":"2026-06-08T17:24:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/liblaf/logging","commit_stats":null,"previous_names":["liblaf/logging"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liblaf/logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liblaf%2Flogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liblaf%2Flogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liblaf%2Flogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liblaf%2Flogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liblaf","download_url":"https://codeload.github.com/liblaf/logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liblaf%2Flogging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34439294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-17T07:31:00.515Z","updated_at":"2026-06-17T07:31:01.519Z","avatar_url":"https://github.com/liblaf.png","language":"Python","funding_links":["https://afdian.com/a/liblaf"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" markdown\u003e\n\n![liblaf-logging](https://socialify.git.ci/liblaf/logging/image?description=1\u0026forks=1\u0026issues=1\u0026language=1\u0026name=1\u0026owner=1\u0026pattern=Transparent\u0026pulls=1\u0026stargazers=1\u0026theme=Auto)\n\n**[Explore the docs »](https://liblaf.github.io/logging/)**\n\n[![PyPI - Version](https://img.shields.io/pypi/v/liblaf-logging?logo=PyPI)](https://pypi.org/project/liblaf-logging/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/liblaf-logging?logo=Python)](https://pypi.org/project/liblaf-logging/)\n[![PyPI - Types](https://img.shields.io/pypi/types/liblaf-logging?logo=PyPI)](https://pypi.org/project/liblaf-logging/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/liblaf-logging?logo=PyPI)](https://pypi.org/project/liblaf-logging/)\n[![Test](https://github.com/liblaf/logging/actions/workflows/python-test.yaml/badge.svg)](https://github.com/liblaf/logging/actions/workflows/python-test.yaml)\n[![Docs](https://github.com/liblaf/logging/actions/workflows/python-docs.yaml/badge.svg)](https://github.com/liblaf/logging/actions/workflows/python-docs.yaml)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)\n\n[Documentation](https://liblaf.github.io/logging/) · [Source](https://github.com/liblaf/logging) · [Issues](https://github.com/liblaf/logging/issues) · [Releases](https://github.com/liblaf/logging/releases)\n\n![Rule](https://cdn.jsdelivr.net/gh/andreasbm/readme/assets/lines/rainbow.png)\n\n\u003c/div\u003e\n\n## ✨ Features\n\n- **Caller-aware helpers**: `liblaf.logging.info()` and friends attribute shared helper logs to the first visible caller frame.\n- **Rich console and file output**: Handlers render compact time, level, location, highlighted messages, Rich renderables, pretty objects, and tracebacks.\n- **Scoped array and tensor summaries**: NumPy, Torch, and JAX output is compacted while records are rendered when those libraries are already imported.\n- **Per-record rate limits**: Add `extra={\"limits\": \"1/minute\"}` or a `LimitOptions` object to suppress noisy repeat logs.\n- **Process hooks**: `init()` captures warnings, uncaught exceptions, and unraisable exceptions through the standard logging pipeline.\n- **Release-aware defaults**: Development and prerelease distributions can get louder logger defaults while stable installed modules stay at `NOTSET`.\n\n## 📦 Installation\n\n```bash\nuv add liblaf-logging\n```\n\n## 🚀 Quick Start\n\n```python\nimport liblaf.logging\n\nliblaf.logging.init(force=True)\nliblaf.logging.info(\"ready\")\n```\n\n`init()` configures the root logger at `INFO` by default, installs Rich output,\nregisters `TRACE` and `ICECREAM` level names, captures warnings, and adds\nexception hooks. When it creates handlers itself, each managed handler receives\na `LimitsFilter`. While a record is rendered, NumPy, Torch, and JAX print\noptions are scoped to compact summaries if those libraries are already loaded.\n\nUse the module-level helpers when library or framework glue should log as the\napplication code that called it.\n\n```python\nimport liblaf.logging\n\n\ndef announce() -\u003e None:\n    liblaf.logging.info(\"starting\")\n```\n\n## 🚦 Rate Limits\n\nAttach a `limits` value to an individual record.\n\n```python\nimport liblaf.logging\n\nliblaf.logging.warning(\"still waiting\", extra={\"limits\": \"1/minute\"})\n```\n\nFor shared buckets, custom identifiers, or non-default costs, pass\n`LimitOptions`.\n\n```python\nfrom liblaf.logging.filters import LimitOptions\n\nliblaf.logging.warning(\n    \"sync retry\",\n    extra={\n        \"limits\": LimitOptions(\n            \"5/minute\",\n            namespace=(\"sync\",),\n            identifiers=(\"account-42\",),\n            cost=1,\n        )\n    },\n)\n```\n\n## ⚙️ Configuration\n\nSettings use the `LOG_` environment prefix through\n[`liblaf-conf`](https://github.com/liblaf/conf). The most common options are\n`LOG_LEVEL`, `LOG_FILE`, `LOG_TIME_RELATIVE`, `LOG_HIDE_FRAME`, and\n`LOG_HIDE_STABLE_RELEASE`.\n\n```bash\nLOG_LEVEL=DEBUG LOG_FILE=logs/app.log python app.py\n```\n\n## 🧭 Release-Aware Defaults\n\n`SanitizedLogger` checks module files against selected installed distributions\nwhen a logger is created without an explicit level. `.devN` distributions use\nthe development level, prerelease distributions use the prerelease level, and\nstable distributions keep the normal `NOTSET` logger default.\n\nThe classifier expands metadata only for those selected distributions. Exact\nfiles are matched directly, and `.pth` files from selected distributions add\nsource-tree prefixes for editable-style layouts. Stable distribution metadata is\nnot expanded, and `direct_url.json` is not followed.\n\n## ⌨️ Local Development\n\n```bash\ngit clone https://github.com/liblaf/logging.git\ncd logging\nuv sync\nuv run pytest\nmise run docs:build\n```\n\n### 📝 License\n\nCopyright © 2026 [liblaf](https://github.com/liblaf). \u003cbr /\u003e\nThis project is [MIT](https://github.com/liblaf/logging/blob/main/LICENSE) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliblaf%2Flogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliblaf%2Flogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliblaf%2Flogging/lists"}