{"id":13738655,"url":"https://github.com/mahmoud/lithoxyl","last_synced_at":"2025-04-06T22:08:50.972Z","repository":{"id":9025056,"uuid":"10783537","full_name":"mahmoud/lithoxyl","owner":"mahmoud","description":"Application instrumentation and logging, with a geological bent.","archived":false,"fork":false,"pushed_at":"2022-08-05T20:41:09.000Z","size":513,"stargazers_count":145,"open_issues_count":7,"forks_count":10,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-30T19:09:28.580Z","etag":null,"topics":["composability","instrumentation","logging","performance","python","pythonic"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahmoud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-19T06:54:45.000Z","updated_at":"2024-11-28T16:27:23.000Z","dependencies_parsed_at":"2022-09-12T22:00:13.454Z","dependency_job_id":null,"html_url":"https://github.com/mahmoud/lithoxyl","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoud%2Flithoxyl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoud%2Flithoxyl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoud%2Flithoxyl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoud%2Flithoxyl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahmoud","download_url":"https://codeload.github.com/mahmoud/lithoxyl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["composability","instrumentation","logging","performance","python","pythonic"],"created_at":"2024-08-03T03:02:31.474Z","updated_at":"2025-04-06T22:08:50.949Z","avatar_url":"https://github.com/mahmoud.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# lithoxyl\n\nApplication instrumentation and logging, with a geological\nbent. Documentation is available on\n[Read the Docs](http://lithoxyl.readthedocs.io).\n\n## An infomercial of sorts\n\n\"Has this ever happened to you?\"\n\nHere's an example of some ostensibly well-instrumented code.\n\n```python\nimport logging\n\ndef create_user(name):\n    logging.info('creating user with name %r', name)\n    try:\n        success = _create_user(name)\n        if success:\n            logging.info('successfully created user %r', name)\n        else:\n            logging.error('failed to create user %r', name)\n    except Exception:\n        logging.critical('exception encountered while creating user %r',\n                         name, exc_info=True)\n    return success\n```\n\nNotice how the logging statements tend to dominate the code, almost\ndrowning out the meaning of the code.\n\nHere's lithoxyl's take:\n\n```python\nfrom lithoxyl import stderr_log\n\ndef create_user(name):\n    with stderr_log.critical('user creation', username=name, reraise=False) as r:\n        success = _create_user(name)\n        if not success:\n            r.failure()\n    return success\n```\n\n\n## Feature brief\n\n* Transactional logging\n* Semantic instrumentation\n* Pure Python\n* Pythonic context manager API minimizes developer errors\n* Decorator syntax is convenient and unobtrusive\n* Human-readable structured logs\n* Reparseability thanks to autoescaping\n* Statistical accumulators for prerolled metrics\n* Programmatic configuration with sensible defaults just an import away\n* Synchronous mode for simplicity\n* Asynchronous operation for performance critical applications\n* Log file headers for metadata handling\n* Heartbeat for periodic output and checkpointing\n* Automatic, fast log parser generation (TBI)\n* Sinks\n    * EWMASink\n    * DebuggerSink\n    * MomentSink\n    * QuantileSink\n    * StreamSink\n    * SyslogSink\n    * and more\n\n## Reasons to use Lithoxyl\n\n* More specific: distinguishes between level and status\n* Safer: Transactional logging ensures that exceptions are always recorded appropriately\n* Lower overhead: Lithoxyl can be used more places in code (e.g., tight loops), as well as more environments, without concern of excess overhead.\n* More Pythonic: Python's logging module is a port of log4j, and it shows.\n* No global state: Lithoxyl has virtually no internal global state, meaning fewer gotchas overall\n* Higher concurrency: less global state and less overhead mean fewer places where contention can occur\n* More succinct: Rather than try/except/finally, use a simple with block\n* More useful: Lithoxyl represents a balance between logging and profiling\n* More composable: Get exactly what you want by recombining new and provided components\n* More lightweight: Simplicity, composability, and practicality, make Lithoxyl something one might reach for earlier in the development process. Logging shouldn't be an afterthought, nor should it be a big investment that weighs down development, maintenance, and refactoring.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoud%2Flithoxyl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmoud%2Flithoxyl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoud%2Flithoxyl/lists"}