Metadata-Version: 2.1
Name: logdriver
Version: 0.1.2
Summary: Run a socket server for application logging
Author: Steve King
Author-email: steve@steveking.site
License: MIT License
Project-URL: homepage, https://github.com/sjking/logdriver
Keywords: logging,logger,microservice,cli
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Logging
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# logdriver

Run a socket server for application logging.
Implemented as a CLI. Receives pickled LogRecord objects over a socket, 
buffers them, and handles them according to application requirements.


<p align="center">
<p align="center">
<a href="https://pypi.org/project/fastapi" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions">
</a>
</p>

## Installation

```shell
pip install logdriver
```

## Example

Start `logdriver` on the command-line using default options. This will start the socket
server listening on `localhost` on port `9079`. It will use a `StreamLogger` to log
all the LogRecords it receives to `stdout`, and set the logging level to `WARNING`.

```shell
$ logdriver
Started logdriver logging socket server
Listening for logs on localhost:9079
Press CTRL+C to quit
Starting TCP server
```

In your Python application, configure your logger to use a `SocketHandler`:

```python
import logging
from logging.handlers import SocketHandler
handler = SocketHandler("localhost", 9079)
logger = logging.getLogger(__name__)
logger.addHandler(handler)

logger.warning("Hello, world!")
```

You should see the log getting printed by the socket server.
