Skip to main content

A package for redirecting stdout/stderr to a file.

Project description

This 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: `python import streamtologger streamtologger.redirect() ` Have a look at the provided [example](examples/test.py) in order to try it by yourself. It really is that easy ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamtologger-2017.1.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file streamtologger-2017.1.tar.gz.

File metadata

File hashes

Hashes for streamtologger-2017.1.tar.gz
Algorithm Hash digest
SHA256 9db48302a95caf0ca3708fa485c3a9c7eb0c5862ccab21fd1c1ddce10d61729d
MD5 b1d56ecef514365c76b75d2568c17c3c
BLAKE2b-256 184b253a7bb442f70855f74c39e948da3b8a83027736a7e6b9d4cdb3b85627df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page