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.0rc1.tar.gz (18.6 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.0rc1-cp310-abi3-macosx_11_0_arm64.whl (7.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

std_nslog-2.0.0rc1-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.0rc1-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.0rc1.tar.gz.

File metadata

  • Download URL: std_nslog-2.0.0rc1.tar.gz
  • Upload date:
  • Size: 18.6 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.0rc1.tar.gz
Algorithm Hash digest
SHA256 97ab9989bece034d9fe00276444edd4bd43a8708483c79d9009a893346bfe410
MD5 9f466a0d68cb5fcae1a02f06fc1db09a
BLAKE2b-256 5f6cddd4bdebeae705fd95f5046c6de44d58ff7462fd93cc0d146587dca37b00

See more details on using hashes here.

Provenance

The following attestation bundles were made for std_nslog-2.0.0rc1.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.0rc1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0rc1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49da11d238d7807b11aeb03cbaef08a6e16dce423866b64a7737666156852868
MD5 58a65d5cf811cc122766de8bc6d968bf
BLAKE2b-256 e2198bf3c1b3e61ecc80eb701ffb8e775a7b173ba4129ae1507bee8323ced1b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for std_nslog-2.0.0rc1-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.0rc1-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0rc1-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 40cd3a3fc2330fd2749662c9268b402f09fe9642f617e04b16e7099ff484b04d
MD5 883da9f89ae82b0b595c87b7e2a80cec
BLAKE2b-256 8e16d1269db9e02a4fecf9c2512fbbc8541936676b73a27b5711694f6d7640d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for std_nslog-2.0.0rc1-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.0rc1-cp310-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for std_nslog-2.0.0rc1-cp310-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 cc43bfdbe70992f8ff584ddbb33998e1ad7709e1c24d7a90a5b8b30be7498d7c
MD5 c3ed5f4f9fa7dc9660b6b2e782bf0ca7
BLAKE2b-256 373382ce5d88550fe29ef4ae23c16053948106ebfe3dcf64e4b8a7a706919d4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for std_nslog-2.0.0rc1-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