Skip to main content

Run a socket server for application logging

Project description

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.

Supported Python versions

Installation

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.

$ 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:

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.

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

logdriver-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

logdriver-0.1.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file logdriver-0.1.2.tar.gz.

File metadata

  • Download URL: logdriver-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for logdriver-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5b2b36564b13e40c8518a93840a91f8b083a52c569ae5f9ff095a8b363e23683
MD5 658f6d9f35b3196dc3d094c085e137e8
BLAKE2b-256 eb63f83dea26f5fabfa21fa46013ec129fe537ff9b3004ced2173e04551891fc

See more details on using hashes here.

Provenance

File details

Details for the file logdriver-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: logdriver-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for logdriver-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6724624ec9f0b0985df688167ce36e545a97947e4f22245ab37cc8b6d3a53168
MD5 85016d1ea76623e9551b98004255963b
BLAKE2b-256 ebf4f04d2921ed0037916ed860f6420cf0fdef332cc412df1c51422f6dbe57f8

See more details on using hashes here.

Provenance

Supported by

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