{"id":37734345,"url":"https://github.com/libranet/libranet-logging","last_synced_at":"2026-01-16T13:56:44.122Z","repository":{"id":62575957,"uuid":"279867605","full_name":"libranet/libranet-logging","owner":"libranet","description":"Easy-to-use logging-configuration using a logging.yml-file","archived":false,"fork":false,"pushed_at":"2025-09-02T13:44:16.000Z","size":1556,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-30T04:53:57.360Z","etag":null,"topics":["logging"],"latest_commit_sha":null,"homepage":"https://libranet-logging.readthedocs.io/en/latest","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/libranet.png","metadata":{"files":{"readme":"docs/readme.md","changelog":null,"contributing":"docs/contributing.md","funding":".github/funding.yaml","license":"license.md","code_of_conduct":"docs/code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"docs/security.md","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":{"github":["libranet"]}},"created_at":"2020-07-15T12:52:06.000Z","updated_at":"2025-04-30T12:21:46.000Z","dependencies_parsed_at":"2023-02-13T21:01:14.841Z","dependency_job_id":"c0aa1d17-d51a-4e0b-8ddf-788569c3509d","html_url":"https://github.com/libranet/libranet-logging","commit_stats":null,"previous_names":["libranet/libranet_logging"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/libranet/libranet-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libranet%2Flibranet-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libranet%2Flibranet-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libranet%2Flibranet-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libranet%2Flibranet-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libranet","download_url":"https://codeload.github.com/libranet/libranet-logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libranet%2Flibranet-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["logging"],"created_at":"2026-01-16T13:56:42.415Z","updated_at":"2026-01-16T13:56:44.114Z","avatar_url":"https://github.com/libranet.png","language":"Python","funding_links":["https://github.com/sponsors/libranet"],"categories":[],"sub_categories":[],"readme":"[![Testing](https://img.shields.io/github/actions/workflow/status/libranet/libranet-logging/testing.yaml?branch=main\u0026longCache=true\u0026style=flat-square\u0026label=tests\u0026logo=GitHub%20Actions\u0026logoColor=fff\")](https://github.com/libranet/libranet-logging/actions/workflows/testing.yaml)\n[![Linting](https://img.shields.io/github/actions/workflow/status/libranet/libranet-logging/linting.yaml?branch=main\u0026longCache=true\u0026style=flat-square\u0026label=Linting\u0026logo=GitHub%20Actions\u0026logoColor=fff\")](https://github.com/libranet/libranet-logging/actions/workflows/linting.yaml)\n[![Read the Docs](https://readthedocs.org/projects/libranet-logging/badge/?version=latest)](https://libranet-logging.readthedocs.io/en/latest/)\n[![Codecov](https://codecov.io/gh/libranet/libranet-logging/branch/main/graph/badge.svg?token=5QL5P68B80)](https://codecov.io/gh/libranet/libranet-logging)\n[![PyPi Package](https://img.shields.io/pypi/v/libranet-logging?color=%2334D058\u0026label=pypi%20package)](https://pypi.org/project/libranet-logging/)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/libranet/libranet-logging/blob/main/docs/license.md)\n\n\n## Installation\n\nInstall via pip:\n\n```bash\n\u003e bin/pip install libranet-logging\n```\n\nvia uv\n\n```bash\n\u003e uv add libranet-logging\n```\n\nvia poetry:\n\n```bash\n\u003e poetry add libranet-logging\n```\n\n\n# Why use logging?\n\nLogfiles are your best-friend\n\n  - during development, where debugmode is developmentmode\n\n  - more important: while running in PRD,\n    - it shows how the application is being used, by whom, and if it's successfull\n    - allows to become pro-active. There is no need to wait for bugreports from users.\n\n  - most important: during urgent troubleshooting on PRD (AKA panic-mode)\n    - heisenbugs,  difficult to reproduce.\n\n\n# Goal of libranet-logging\n\nMake it as easy as possible to enable and properly use the full power of the python logging-framework\n\npython logging-module contains:\n  - loggers, hierarchical\n  - handlers\n    - formatters\n    - filters\n\nThink of logger=message-channel, handler=subscriber to a channel\n\nMinimize the need to make changes in code\n\nMove all config out of code and into a config-file \"logging.yml\"\n\n  - logging to a file should be as simple as:\n\n        ```python\n        \u003e\u003e\u003e import logging\n        \u003e\u003e\u003e logging.getLogger('panicmode')\n        ```\n\n\n# Usage\n\n## In your deployment\n\nYou can use following env-variables:\n\n    - LOGGING_YML_FILE, path to logging.yml, e.g  /opt/miniconda/envs/libranet/etc/logging.yml\n    - LOG_DIR, path to log-directory where logfiles will be created, /var/tmp/python\n    - PYTHON_ENABLE_LOGGING_TREE  1|0\n\n  optional env-vars:\n    - LOGLEVEL_ROOT\n    - LOGLEVEL_libranet_logging\n    - LOG_HANDLERS=\"console|debug_file|info_file|warning_file|error_file\"\n\n\n    If missing, these default to DEBUG\n\n\n## In your code\n\nTo initialize the logging-infrastructure and set-up all configured\nloggers, handlers, formatters and filters:\n\n```python\n  \u003e import libranet_logging\n  \u003e libranet_logging.initialize()\n    2018/06/01 10:00:00 - root - DEBUG   - Logging configured from \u003cpath-to\u003e/logging.yml\n```\n\nYou do this once in your application,\nin the function that starts execution, not at the top of your module.\n\n```python\n  # Calling getLogger without arguments returns the root-logger,\n  # of which all other loggers descend.\n  # Normally you do NOT need this logger.\n  \u003e import logging\n  \u003e root_log = logging.getLogger()\n\n  # You normally use the module-logger\n  \u003e log = logging.getLogger(__name__)\n\n  # and starting using it\n  \u003e log.debug('This is debugging-information.')\n  \u003e log.info('This is useful information.')\n  \u003e log.warning('This is a warning.')\n  \u003e log.error('This is a warning.')\n\n  # You can log a full-traceback by providing the exception to log.exception().\n  \u003e try:\n  \u003e     import foo\n  \u003e except ImportError as e:\n  \u003e     log.exception(e)\n```\n\n\n# Features\n\n - load logging-configuration from a yaml-config\n\n - validate yaml-file for missing keys, invalid values\n\n - configurable via env-variables\n   - sane defaults if env-var is not set\n\n - when logging to console, have colorized logging,\n   - but nowhere else\n   - configurable colors (avoid blue on black)\n\n - integrate python-warnings\n - add sample email-logger\n - add sample syslog-logger\n\n - avoid empty files that will remain empty\n   - cleanup dedicated file-handlers based on root-loglevel\n\n - future ideas:\n   - integrate with kibana\n   - log as json, structlog\n\n       - https://logmatic.io/blog/python-logging-with-json-steroids/\n       - https://medium.com/@sanchitsokhey/centralised-logging-for-django-gunicorn-and-celery-using-elk-stack-76b13c54414c\n       - https://logmatic.io/blog/beyond-application-monitoring-discover-logging-best-practices/\n\n\n - in code throw out all\n   - formatting,\n   - handler-config,\n   - setting loglevel\n   - debug-flags like::\n\n        ```python\n        \u003e\u003e\u003e if DEBUG:\n        \u003e\u003e\u003e     log.debug(....)\n        ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibranet%2Flibranet-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibranet%2Flibranet-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibranet%2Flibranet-logging/lists"}