{"id":34075489,"url":"https://github.com/lkellermann/logging-decorator","last_synced_at":"2026-04-07T07:02:26.555Z","repository":{"id":57438811,"uuid":"400654992","full_name":"lkellermann/logging-decorator","owner":"lkellermann","description":"An easy way to log your methods in Python.","archived":false,"fork":false,"pushed_at":"2025-08-05T15:24:10.000Z","size":32,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-16T11:30:05.972Z","etag":null,"topics":["decorators","logging","python"],"latest_commit_sha":null,"homepage":"","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/lkellermann.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}},"created_at":"2021-08-27T23:09:03.000Z","updated_at":"2024-06-13T17:53:37.000Z","dependencies_parsed_at":"2022-09-08T09:50:10.464Z","dependency_job_id":null,"html_url":"https://github.com/lkellermann/logging-decorator","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/lkellermann/logging-decorator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkellermann%2Flogging-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkellermann%2Flogging-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkellermann%2Flogging-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkellermann%2Flogging-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkellermann","download_url":"https://codeload.github.com/lkellermann/logging-decorator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkellermann%2Flogging-decorator/sbom","scorecard":{"id":595102,"data":{"date":"2025-08-11","repo":{"name":"github.com/lkellermann/logging-decorator","commit":"a9bf3d4961c1197cb6ac4af8698dc57ad2d76acd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T22:57:47.370Z","repository_id":57438811,"created_at":"2025-08-20T22:57:47.370Z","updated_at":"2025-08-20T22:57:47.370Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31503394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["decorators","logging","python"],"created_at":"2025-12-14T09:47:31.048Z","updated_at":"2026-04-07T07:02:26.545Z","avatar_url":"https://github.com/lkellermann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n\u003cdiv align=\"left\"\u003e\r\n\r\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\r\n[![GitHub Issues](https://img.shields.io/github/issues/lkellermann/logging-decorator.svg)](https://github.com/lkellermann/logging-decorator/issues)\r\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/lkellermann/logging-decorator.svg)](https://github.com/lkellermann/logging-decorator/pulls)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\r\n\u003c/div\u003e\r\n\r\n# LoggingDecorator\r\n## About \u003ca name = \"about\"\u003e\u003c/a\u003e\r\n\r\nLoggingDecorator is a MIT licensed general-purpose software package written in Python that simplyfies the task of logging methods of other Python scripts.\r\n\r\n## Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\r\n\r\nTo install this package you can just type in your Python terminal:\r\n\r\n```shell\r\npip install logging-decorator\r\n```\r\n\r\n### Requirements\r\n\r\nThis Python package only works with `Python 3.6` or later.\r\n\r\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\r\n\r\nThe simplest use case is logging a generic method and displaying the log on screen.\r\n```python\r\nfrom LoggingDecorator import logd\r\n\r\n@logd\r\ndef foo():\r\n  print('foo method')\r\n\r\ndef main():\r\n  foo()\r\n\r\nif __name__ == '__main__'\r\n  main()\r\n```\r\n\r\n## Features \u003ca name=\"-gem-features-\"\u003e\u003c/a\u003e\r\n\r\n- Generate `.log` files inside a `log` folder in the current working directory.\r\n\r\n```python\r\nfrom LoggingDecorator import logd\r\n\r\n@logd(file=True)\r\ndef foo():\r\n  print('foo method')\r\n\r\ndef main():\r\n  foo()\r\n\r\nif __name__ == '__main__'\r\n  main()\r\n```\r\n\r\n- Continue running the script if an exception is raised:\r\n\r\n```python\r\nfrom LoggingDecorator import logd\r\n\r\n@logd(raise_error=False)\r\ndef foo():\r\n  print('foo method')\r\n\r\ndef main():\r\n  foo()\r\n\r\nif __name__ == '__main__'\r\n  main()\r\n```\r\n\r\n- Set logging level:\r\n\r\n```python\r\nfrom LoggingDecorator import logd\r\n\r\n@logd(logging_level='critical')\r\ndef foo():\r\n  print('foo method')\r\n\r\ndef main():\r\n  foo()\r\n\r\nif __name__ == '__main__'\r\n  main()\r\n```\r\n    \r\n  - The available options are: `critical`, `error`, `warning`, `info`, `debug` and `notset`.\r\n## Output Sample\r\n\r\nSupose that you have a `foo` project with the following structure:\r\n```\r\n📦foo\r\n ┗ 📜foo.py\r\n ```\r\n And the contents of the `foo.py` file is the following:\r\n```python\r\nfrom time import sleep\r\nfrom LoggingDecorator import logd\r\n\r\n@logd(file=True, logging_level='debug')\r\ndef foo_sum(a:int, b:int=1):\r\n    sleep(3)\r\n    return a+b\r\n\r\n@logd(file=False, raise_error=True)\r\ndef foo_div(a:int, b:int=0):\r\n    return a/b\r\n\r\ndef main():\r\n    foo_sum(1)\r\n    foo_div(5)\r\n    \r\nif __name__=='__main__':\r\n    main()\r\n```\r\n\r\nThe method `foo_sum` will print and generate a file like `./foo/log/foo_foo_sum_28Aug2021_114203.log` with the following content:\r\n\r\n```\r\n2021-08-28 11:42:03,695 - Working directory:     /absolute/path/to/foo\r\n2021-08-28 11:42:03,695 - Module name:           __main__\r\n2021-08-28 11:42:03,696 - Method name:           foo_sum\r\n2021-08-28 11:42:03,696 - Error message:         None\r\n2021-08-28 11:42:03,696 - Start time:            2021-08-28 11:42:00.690282\r\n2021-08-28 11:42:03,696 - End time:              2021-08-28 11:42:03.694016\r\n2021-08-28 11:42:03,696 - Elapsed time:          0:00:03.003734\r\n2021-08-28 11:42:03,697 - Variables:             (a: int, b: int = 1)\r\n2021-08-28 11:42:03,697 - Args:                  None\r\n2021-08-28 11:42:03,697 - Kwargs:                None\r\n2021-08-28 11:42:03,697 - Log path:              /absolute/path/to/foo/log/foo_foo_sum_28Aug2021_114203.log\r\n```\r\n\r\nAnd the `foo_div` will generate the following message in your screen:\r\n\r\n```\r\n\r\n2021-08-28 11:42:03,698 - Module name:           __main__\r\n2021-08-28 11:42:03,699 - Method name:           foo_div\r\n2021-08-28 11:42:03,699 - Error message:         division by zero\r\n2021-08-28 11:42:03,699 - Start time:            2021-08-28 11:42:03.698178\r\n2021-08-28 11:42:03,699 - End time:              2021-08-28 11:42:03.698622\r\n2021-08-28 11:42:03,699 - Elapsed time:          0:00:00.000444\r\n2021-08-28 11:42:03,700 - Variables:             (a: int, b: int = 0)\r\n2021-08-28 11:42:03,700 - Args:                  (5,)\r\n2021-08-28 11:42:03,700 - Kwargs:                {}\r\n2021-08-28 11:42:03,700 - Log path:              None\r\nTraceback (most recent call last):\r\n  File \"/absolute/path/to/foo/foo.py\", line 18, in \u003cmodule\u003e\r\n    main()\r\n  File \"//absolute/path/to/foo/foo/foo.py\", line 15, in main\r\n    foo_div(5)\r\n  File \"/local/python/path/site-packages/LoggingDecorator/LoggingDecorator.py\", line 33, in wrapped_function\r\n    return LoggingDecorator(*dargs, **dkwargs).call(original_method, *args, **kwargs)\r\n  File \"/local/python/path/site-packages/LoggingDecorator/LoggingDecorator.py\", line 78, in call\r\n    return self._summary(original_method, \r\n  File \"/local/python/path/site-packages/LoggingDecorator/LoggingDecorator.py\", line 149, in _summary\r\n    raise LogException(error_message)\r\nLoggingDecorator.LoggingDecorator.LogException: LogException[division by zero]\r\n\r\n```\r\n\r\n\r\n## Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\r\n\r\n- [@lkellermann](https://github.com/lkellermann) - Idea \u0026 Initial work\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkellermann%2Flogging-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkellermann%2Flogging-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkellermann%2Flogging-decorator/lists"}