A shim that redirects stderr/stdout to the Apple unified logging system (os_log)
Project description
std-nslog
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).
Usage
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.
Why no pun?
While an obscure joke referencing apples and logs might be amusing, it would make no sense when it appeared in a Briefcase requirements file.
Community
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.
Contributing
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file std_nslog-2.0.0.tar.gz.
File metadata
- Download URL: std_nslog-2.0.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e4e661d67b69458435dd23eef5d0c1e59d954ccf80b597c398a13afbfbbc11
|
|
| MD5 |
2bb69ceff4f06cd737c95a7321d10eb0
|
|
| BLAKE2b-256 |
b4ecb1dcda86be2310c326e20908068fb2cc8d11a01262c0bbfe41fad1454a69
|
Provenance
The following attestation bundles were made for std_nslog-2.0.0.tar.gz:
Publisher:
publish.yml on beeware/std-nslog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
std_nslog-2.0.0.tar.gz -
Subject digest:
63e4e661d67b69458435dd23eef5d0c1e59d954ccf80b597c398a13afbfbbc11 - Sigstore transparency entry: 1799852523
- Sigstore integration time:
-
Permalink:
beeware/std-nslog@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/beeware
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Trigger Event:
release
-
Statement type:
File details
Details for the file std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d01bce53bbca2aba23ed0d537302b59488182b0658a8502172977f05bb21957b
|
|
| MD5 |
ad839cdd25fc5766ce14a1e7eff8985b
|
|
| BLAKE2b-256 |
528342efa1059c797434927b480b09ddbe824506a25c584e1ad2a0db200c82e6
|
Provenance
The following attestation bundles were made for std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on beeware/std-nslog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
d01bce53bbca2aba23ed0d537302b59488182b0658a8502172977f05bb21957b - Sigstore transparency entry: 1799852708
- Sigstore integration time:
-
Permalink:
beeware/std-nslog@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/beeware
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Trigger Event:
release
-
Statement type:
File details
Details for the file std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 6.9 kB
- Tags: CPython 3.10+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f377c4d98279eb246053564e17d7943de2933a9243386f1c09092d6344df90
|
|
| MD5 |
9b055637b1c34a3d1530522348c3a251
|
|
| BLAKE2b-256 |
ba3464c89bf5269f16590886b631f6eefb28265f529464a0d367d82245b023d8
|
Provenance
The following attestation bundles were made for std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl:
Publisher:
publish.yml on beeware/std-nslog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl -
Subject digest:
50f377c4d98279eb246053564e17d7943de2933a9243386f1c09092d6344df90 - Sigstore transparency entry: 1799852613
- Sigstore integration time:
-
Permalink:
beeware/std-nslog@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/beeware
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Trigger Event:
release
-
Statement type:
File details
Details for the file std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl.
File metadata
- Download URL: std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl
- Upload date:
- Size: 8.5 kB
- Tags: CPython 3.10+, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
847e39549bf04163bd90cfb2ba004c062aeea856b94b12d389d870fbc195652e
|
|
| MD5 |
d49d5528b0b0baf6228960f26f725d1c
|
|
| BLAKE2b-256 |
4dbca9b0e940758a92a3811e63d7524a97107c3224d0c50ea5152e79f1377f2f
|
Provenance
The following attestation bundles were made for std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl:
Publisher:
publish.yml on beeware/std-nslog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl -
Subject digest:
847e39549bf04163bd90cfb2ba004c062aeea856b94b12d389d870fbc195652e - Sigstore transparency entry: 1799852857
- Sigstore integration time:
-
Permalink:
beeware/std-nslog@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/beeware
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f2893aa08b3e8f75b6f8a70859b221ffa45518b -
Trigger Event:
release
-
Statement type: