std-nslog is a shim that redirects stderr/stdout to the Apple unified logging system (os_log, the modern replacement for NSLog). This can be useful when deploying Python code as a standalone app on macOS or iOS, where stdout/stderr aren't easily visible for end users.
This functionality is baked into Python 3.14+ if you are using an embedded interpreter - set config.use_system_logger = 1 when configuring the interpreter. The same functionality exists in all iOS CPython builds (where it is enabled by default).
std-nslog will generally only be needed in the context of a bundled macOS application. You shouldn't ever need to install it yourself into a local virtual environment. However, just in case...
To install std-nslog:
$ pip install std-nslog
Then, in your code, import nslog. This will install the shim. The file only needs to be imported once; preferably as early as possible in the Python application code.
Once installed, all output written to stdout and stderr will be redirected to the unified logging system; stdout is logged at OS_LOG_TYPE_DEFAULT, and stderr at OS_LOG_TYPE_ERROR, so the two streams can be filtered separately in Console.app or log stream.
While an obscure joke referencing apples and logs might be amusing, it would make no sense when it appeared in a Briefcase requirements file.
std-nslog is part of the BeeWare suite. You can talk to the community through:
We foster a welcoming and respectful community as described in our BeeWare Community Code of Conduct.
If you experience problems with std-nslog, log them on GitHub. If you want to contribute, please fork the project and submit a pull request.
