{"id":13737629,"url":"https://github.com/arnowaczynski/loggify","last_synced_at":"2026-03-11T17:03:14.043Z","repository":{"id":45316887,"uuid":"253739055","full_name":"arnowaczynski/loggify","owner":"arnowaczynski","description":"Capture prints and tracebacks to a log file with 2 lines of code","archived":false,"fork":false,"pushed_at":"2021-12-21T17:21:30.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T17:18:44.658Z","etag":null,"topics":["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/arnowaczynski.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":"2020-04-07T08:54:37.000Z","updated_at":"2022-07-23T03:42:37.000Z","dependencies_parsed_at":"2022-09-17T05:02:45.015Z","dependency_job_id":null,"html_url":"https://github.com/arnowaczynski/loggify","commit_stats":null,"previous_names":["arnowaczynski/loggify","ar-nowaczynski/loggify"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnowaczynski%2Floggify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnowaczynski%2Floggify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnowaczynski%2Floggify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnowaczynski%2Floggify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnowaczynski","download_url":"https://codeload.github.com/arnowaczynski/loggify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253085786,"owners_count":21851700,"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":["logging","python"],"created_at":"2024-08-03T03:01:55.504Z","updated_at":"2025-12-14T00:15:57.113Z","avatar_url":"https://github.com/arnowaczynski.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Loggify: capture prints and tracebacks to a log file with 2\u0026nbsp;lines of code\n\n[![Python](https://img.shields.io/badge/Python-3.7%20%7C%203.8%20%7C%203.9-blue)](https://www.python.org/downloads/)\n[![PyPI version](https://img.shields.io/pypi/v/loggify?color=1)](https://pypi.org/project/loggify/)\n[![license](https://img.shields.io/pypi/l/loggify)](https://github.com/ar-nowaczynski/loggify)\n\nLoggify is a convenient way to redirect stdout and stderr to the timestamped log file. It works by temporarily overriding the default behaviour of `sys.stdout` and `sys.stderr` in the context manager. You still see the output in the console - it is just additionally streamed to the log file (see the example below).\n\n## Installation\n\n```bash\n$ pip install loggify\n```\n\n## Usage\n\nscript.py:\n\n```python\nfrom loggify import Loggify\n\ndef main():\n    print(\"START\")\n    for i in range(10):\n        print(\" \" * i + \"x\")\n    print(\"END\")\n    5 / 0   # traceback will be captured\n\nwith Loggify(\"main.log\"):  # specify output filename\n    main()\n```\n\nmain.log:\n```\n2020-04-07 20:45:18.391:STDOUT:START\n2020-04-07 20:45:18.391:STDOUT:x\n2020-04-07 20:45:18.391:STDOUT: x\n2020-04-07 20:45:18.391:STDOUT:  x\n2020-04-07 20:45:18.391:STDOUT:   x\n2020-04-07 20:45:18.391:STDOUT:    x\n2020-04-07 20:45:18.391:STDOUT:     x\n2020-04-07 20:45:18.391:STDOUT:      x\n2020-04-07 20:45:18.391:STDOUT:       x\n2020-04-07 20:45:18.391:STDOUT:        x\n2020-04-07 20:45:18.391:STDOUT:         x\n2020-04-07 20:45:18.392:STDOUT:END\n2020-04-07 20:45:18.392:STDERR:Traceback (most recent call last):\n2020-04-07 20:45:18.392:STDERR:  File \"script.py\", line 11, in \u003cmodule\u003e\n2020-04-07 20:45:18.392:STDERR:    main()\n2020-04-07 20:45:18.392:STDERR:  File \"script.py\", line 8, in main\n2020-04-07 20:45:18.392:STDERR:    5 / 0   # traceback will be captured\n2020-04-07 20:45:18.392:STDERR:ZeroDivisionError: division by zero\n```\n\n## License\n\nMIT License (see [LICENSE](https://github.com/ar-nowaczynski/loggify/blob/master/LICENSE)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnowaczynski%2Floggify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnowaczynski%2Floggify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnowaczynski%2Floggify/lists"}