{"id":23469887,"url":"https://github.com/vapor-ware/containerlog","last_synced_at":"2025-04-14T16:33:49.337Z","repository":{"id":37986687,"uuid":"281105730","full_name":"vapor-ware/containerlog","owner":"vapor-ware","description":"A lightweight, optimized, and opinionated structured logging library for Python, intended for containerized applications","archived":false,"fork":false,"pushed_at":"2022-08-22T01:32:34.000Z","size":421,"stargazers_count":7,"open_issues_count":9,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T22:03:10.100Z","etag":null,"topics":["container","fast","logging","structured-logging"],"latest_commit_sha":null,"homepage":"https://containerlog.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vapor-ware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2020-07-20T12:07:25.000Z","updated_at":"2024-11-28T09:45:19.000Z","dependencies_parsed_at":"2022-09-09T00:10:40.533Z","dependency_job_id":null,"html_url":"https://github.com/vapor-ware/containerlog","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/vapor-ware%2Fcontainerlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-ware%2Fcontainerlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-ware%2Fcontainerlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-ware%2Fcontainerlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vapor-ware","download_url":"https://codeload.github.com/vapor-ware/containerlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248916629,"owners_count":21182843,"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":["container","fast","logging","structured-logging"],"created_at":"2024-12-24T15:36:46.180Z","updated_at":"2025-04-14T16:33:49.307Z","avatar_url":"https://github.com/vapor-ware.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# containerlog\n\nA lightweight, optimized, and opinionated structured logging library for Python, intended for containerized applications.\n\n`containerlog` was born out of a desire to have high-quality structured logging for\ncontainerized applications (e.g. microservices) without having to compromise detailed\nlogging for application/request latency.\n\n[`structlog`](https://www.structlog.org/en/stable/) is a great general-purpose structured\nlogging library for Python, but being general-purpose means that there is additional overhead\nwhen logging messages.\n\nWhen [we](https://github.com/vapor-ware) updated a microservice to use structured logging,\nwe found that [request latency went up](https://github.com/vapor-ware/synse-server/issues/384),\nseemingly due to the transition to use `structlog`.\n\n`containerlog` is not for everyone. It is highly opinionated, minimally configurable,\nand intentionally feature-sparse so that it can achieve [better performance](#benchmarks) than\nthe Python standard logger\n\nNot every application needs optimized logging, but where latency and performance matters,\n`containerlog` could work for you.\n\n```\ntimestamp='2020-07-23T13:11:28.009804Z' logger='my-logger' level='debug' event='loading configuration' path='./config.yaml'\ntimestamp='2020-07-23T13:11:28.010137Z' logger='my-logger' level='info' event='starting application'\ntimestamp='2020-07-23T13:11:28.010158Z' logger='my-logger' level='warn' event='having too much fun' countdown=[3, 2, 1]\n```\n\n## Installation\n\n`containerlog` can be installed with pip:\n\n```\npip install containerlog\n```\n\nIt is only intended to work for Python 3.6+.\n\n## Usage\n\nSee the documentation at https://containerlog.readthedocs.io/en/latest/\n\n## Optimizations\n\nThere are numerous sources discussion micro-optimizations in Python. This project probably\ndoes not implement them all, so there is room for improvement. Current optimization work has\nleveraged:\n\n* [`dis`](https://docs.python.org/3/library/dis.html): to disassemble python bytecode for analysis\n* [`timeit`](https://docs.python.org/3/library/timeit.html): to measure execution time of code snippets\n\nIf you wish to contribute optimizations and use other libraries, tools, or sources, open a PR to add\nthem to this list.\n\n## Benchmarks\n\nBenchmarking scripts can be found in the [benchmarks](benchmarks) directory. To run,\n\n```\n$ cd benchmarks\n$ ./run.sh\n```\n\nThis will run benchmarks the Python standard logger and for `containerlog`. The latest results\ncan be found below.\n\n### Results\n\nBenchmarks were measured using Python 3.8.0 on macOS 10.15.1 with a 2.9 GHz 6-Core Intel Core i9\nprocessor and 16 GB 2400 MHz DDR4 memory.\n\n![containerlog 0.3.0](benchmarks/results/benchmark-containerlog-0.3.0.png)\n\n| Benchmark | std logger (ns) | std proxy (ns) | containerlog (ns) |\n| --------- | --------------- | -------------- | ----------------- |\n| baseline | 0.68 +/- 0.02 | 0.69 +/- 0.01 | 0.7 +/- 0.02 |\n| silent | 108.0 +/- 6.0 | 1140.0 +/- 50.0 | 51.7 +/- 1.7 |\n| basic | 4750.0 +/- 160.0 | 1140.0 +/- 60.0 | 1070.0 +/- 50.0 |\n| short-simple | 5370.0 +/- 160.0 | 1280.0 +/- 60.0 | 1330.0 +/- 60.0 |\n| long-simple | 5280.0 +/- 180.0 | 1480.0 +/- 70.0 | 2120.0 +/- 60.0 |\n| short-complex | 5630.0 +/- 170.0 | 1500.0 +/- 150.0 | 1480.0 +/- 80.0 |\n| long-complex | 6900.0 +/- 190.0 | 2870.0 +/- 80.0 | 3260.0 +/- 80.0 |\n| exception | 10400.0 +/- 300.0 | 4440.0 +/- 150.0 | 4370.0 +/- 500.0 |\n\n## Contribute\n\nWhile `containerlog` is intentionally feature-sparse, feature requests are welcome. Additionally,\nif you can find any other ways to micro-optimize the codebase, pull requests are very much\nappreciated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor-ware%2Fcontainerlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvapor-ware%2Fcontainerlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor-ware%2Fcontainerlog/lists"}