Skip to main content

A shim that redirects stderr/stdout to the Apple unified logging system (os_log)

Project description

std-nslog

Generic BeeWare Logo

Python Versions PyPI Version Maturity BSD License Discord server

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


Download files

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

Source Distribution

std_nslog-2.0.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl (7.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl (6.9 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl (8.5 kB view details)

Uploaded CPython 3.10+macOS 10.9+ universal2 (ARM64, x86-64)

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

Hashes for std_nslog-2.0.0.tar.gz
Algorithm Hash digest
SHA256 63e4e661d67b69458435dd23eef5d0c1e59d954ccf80b597c398a13afbfbbc11
MD5 2bb69ceff4f06cd737c95a7321d10eb0
BLAKE2b-256 b4ecb1dcda86be2310c326e20908068fb2cc8d11a01262c0bbfe41fad1454a69

See more details on using hashes here.

Provenance

The following attestation bundles were made for std_nslog-2.0.0.tar.gz:

Publisher: publish.yml on beeware/std-nslog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d01bce53bbca2aba23ed0d537302b59488182b0658a8502172977f05bb21957b
MD5 ad839cdd25fc5766ce14a1e7eff8985b
BLAKE2b-256 528342efa1059c797434927b480b09ddbe824506a25c584e1ad2a0db200c82e6

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50f377c4d98279eb246053564e17d7943de2933a9243386f1c09092d6344df90
MD5 9b055637b1c34a3d1530522348c3a251
BLAKE2b-256 ba3464c89bf5269f16590886b631f6eefb28265f529464a0d367d82245b023d8

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0-cp310-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 847e39549bf04163bd90cfb2ba004c062aeea856b94b12d389d870fbc195652e
MD5 d49d5528b0b0baf6228960f26f725d1c
BLAKE2b-256 4dbca9b0e940758a92a3811e63d7524a97107c3224d0c50ea5152e79f1377f2f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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