Metadata-Version: 2.4
Name: std-nslog
Version: 2.0.0rc1
Summary: A shim that redirects stderr/stdout to the Apple unified logging system (os_log)
Author-email: Russell Keith-Magee <russell@keith-magee.com>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/beeware/std-nslog
Project-URL: Funding, https://beeware.org/contributing/membership/
Project-URL: Tracker, https://github.com/beeware/std-nslog/issues
Project-URL: Source, https://github.com/beeware/std-nslog
Keywords: apple,os_log,nslog,system log,macos,ios
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: iOS
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# std-nslog

[<img src="http://beeware.org/static/images/defaultlogo.png" width="72px" alt="Generic BeeWare Logo">](https://beeware.org/)

[![Python Versions](https://img.shields.io/pypi/pyversions/std-nslog.svg)](https://pypi.python.org/pypi/std-nslog) [![PyPI Version](https://img.shields.io/pypi/v/std-nslog.svg)](https://pypi.python.org/pypi/std-nslog) [![Maturity](https://img.shields.io/pypi/status/std-nslog.svg)](https://pypi.python.org/pypi/std-nslog) [![BSD License](https://img.shields.io/pypi/l/std-nslog.svg)](https://github.com/beeware/std-nslog/blob/main/LICENSE) [![Discord server](https://img.shields.io/discord/836455665257021440?label=Discord%20Chat&logo=discord&style=plastic)](https://beeware.org/bee/chat/)

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](http://beeware.org). You can talk to the community through:

- [@beeware@fosstodon.org on Mastodon](https://fosstodon.org/@beeware)
- [Discord](https://beeware.org/bee/chat/)

We foster a welcoming and respectful community as described in our [BeeWare Community Code of Conduct](http://beeware.org/community/code-of-conduct/).

## Contributing

If you experience problems with std-nslog, [log them on GitHub](https://github.com/beeware/std-nslog/issues). If you want to contribute, please [fork the project](https://github.com/beeware/std-nslog) and [submit a pull request](https://github.com/beeware/std-nslog/pulls).
