{"id":22048523,"url":"https://github.com/samhammerag/sag_py_execution_time_decorator","last_synced_at":"2026-03-09T11:02:55.563Z","repository":{"id":164316306,"uuid":"637761470","full_name":"SamhammerAG/sag_py_execution_time_decorator","owner":"SamhammerAG","description":"A decorator for methods to log the execution time (sync and async)","archived":false,"fork":false,"pushed_at":"2025-05-27T09:43:12.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-19T10:32:01.133Z","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/SamhammerAG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2023-05-08T11:01:15.000Z","updated_at":"2025-05-27T09:41:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7056c76-81e3-4467-8ca0-e1dfac006426","html_url":"https://github.com/SamhammerAG/sag_py_execution_time_decorator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/SamhammerAG/sag_py_execution_time_decorator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fsag_py_execution_time_decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fsag_py_execution_time_decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fsag_py_execution_time_decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fsag_py_execution_time_decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamhammerAG","download_url":"https://codeload.github.com/SamhammerAG/sag_py_execution_time_decorator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fsag_py_execution_time_decorator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30291844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"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":[],"created_at":"2024-11-30T14:12:38.546Z","updated_at":"2026-03-09T11:02:55.550Z","avatar_url":"https://github.com/SamhammerAG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sag_py_execution_time_decorator\n\n[![Maintainability][codeclimate-image]][codeclimate-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n\nA decorator for methods to log the execution time (sync and async)\n\n## What it does\n\n- Logs the execution time in milliseconds\n\nSample log entry:\n\n```\ndecorated_sync_method took 1000 ms.\n```\n\nThe entry contains \"function_name\" and \"execution_time\" as extra data.\n\n## Installation\n\npip install sag-py-execution-time-decorator\n\n## How to use\n\nDecorate your methods like that:\n\n```python\nfrom sag_py_execution_time_decorator.execution_time_decorator import log_execution_time\n\n@log_execution_time()\ndef decorated_sync_method(param: str) -\u003e str:\n    time.sleep(SLEEP_TIME_MS / 1000)\n    return f\"test: {param}\"\n\n\n@log_execution_time(log_level=logging.ERROR, log_params=(\"param\",))\nasync def decorated_async_method(param: str) -\u003e str:\n    await asyncio.sleep(SLEEP_TIME_MS / 1000)\n    return f\"test: {param}\"\n\n```\n\nOptional arguments:\n| Argument | Description | Default |\n|-------------|----------------------------------------------------------------------|--------------------------|\n| log_level | The log level integar. Use logging.\\* constants | logging.INFO |\n| logger_name | The name of the logger that is internally used for logging.getLogger | execution_time_decorator |\n| log_params | A tuple of parameter names to be logged with their values in 'extra' | () |\n\n## How to start developing\n\n### With vscode\n\nJust install vscode with dev containers extension. All required extensions and configurations are prepared automatically.\n\n### With pycharm\n\n- Install latest pycharm\n- Install pycharm plugin Mypy\n- Configure the python interpreter/venv\n- pip install requirements-dev.txt\n- Restart pycharm\n\n## How to publish\n\n- Update the version in setup.py and commit your change\n- Create a tag with the same version number\n- Let github do the rest\n\n## How to test\n\nTo avoid publishing to pypi unnecessarily you can do as follows\n\n- Tag your branch however you like\n- Use the chosen tag in the requirements.txt-file of the project you want to test this library in, eg. `sag_py_execution_time_decorator==\u003cyour tag\u003e`\n- Rebuild/redeploy your project\n\n[codeclimate-image]: https://api.codeclimate.com/v1/badges/fa4312e587c8185db077/maintainability\n[codeclimate-url]: https://codeclimate.com/github/SamhammerAG/sag_py_execution_time_decorator/maintainability\n[coveralls-image]: https://coveralls.io/repos/github/SamhammerAG/sag_py_execution_time_decorator/badge.svg?branch=master\n[coveralls-url]: https://coveralls.io/github/SamhammerAG/sag_py_execution_time_decorator?branch=master\n[snyk-image]: https://snyk.io/test/github/SamhammerAG/sag_py_execution_time_decorator/badge.svg\n[snyk-url]: https://snyk.io/test/github/SamhammerAG/sag_py_execution_time_decorator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhammerag%2Fsag_py_execution_time_decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamhammerag%2Fsag_py_execution_time_decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhammerag%2Fsag_py_execution_time_decorator/lists"}