{"id":18746768,"url":"https://github.com/phohenecker/stream-to-logger","last_synced_at":"2025-04-12T22:15:27.738Z","repository":{"id":57471798,"uuid":"96303577","full_name":"phohenecker/stream-to-logger","owner":"phohenecker","description":"A package for redirecting stdout/stderr to a file.","archived":false,"fork":false,"pushed_at":"2018-02-09T07:46:34.000Z","size":22,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T22:15:21.908Z","etag":null,"topics":["logging","python3"],"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/phohenecker.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":"2017-07-05T09:43:06.000Z","updated_at":"2024-04-11T12:55:33.000Z","dependencies_parsed_at":"2022-08-30T15:20:25.483Z","dependency_job_id":null,"html_url":"https://github.com/phohenecker/stream-to-logger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phohenecker%2Fstream-to-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phohenecker%2Fstream-to-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phohenecker%2Fstream-to-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phohenecker%2Fstream-to-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phohenecker","download_url":"https://codeload.github.com/phohenecker/stream-to-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637795,"owners_count":21137538,"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","python3"],"created_at":"2024-11-07T16:26:52.254Z","updated_at":"2025-04-12T22:15:27.717Z","avatar_url":"https://github.com/phohenecker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"stream-to-logger\n================\n\n\nThis package defines a [wrapper class](src/main/python/streamtologger/logger_adapter.py#L38) whose instances pretend to be streams, but forward every write to a logger. A common scenario where this is useful is when we want to redirect all of an application's output, e.g., via `print` or due to any errors that occur, to a file (in addition to the usual printing to the screen). To handle this most important use case, the package provides a [convenience function](src/main/python/streamtologger/__init__.py#L44) that redirects both `stdout` and `stderr` to a file, i.e., you don't even have to create any wrapper by yourself. Just add the following lines to your code:\n```python\nimport streamtologger\nstreamtologger.redirect()\n```\nHave a look at the provided [example](examples/test.py) in order to try it by yourself. It really is that easy ;)\n\n\nInstallation\n------------\n\nThis package can be installed from PyPI:\n```\npip install streamtologger\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphohenecker%2Fstream-to-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphohenecker%2Fstream-to-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphohenecker%2Fstream-to-logger/lists"}