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.

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.5.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

logdriver-0.1.5-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logdriver-0.1.5.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for logdriver-0.1.5.tar.gz
Algorithm Hash digest
SHA256 77fca66598ba93eb81fad0b3fb3faaee838de230285d0725fb98ab8c6e80b568
MD5 882d83a22f3f17bb313d0501b9d157cf
BLAKE2b-256 d95835ce6e460f2f3a1f9e7a3d6fb1b0be149be4693964f9ec25f899b483f371

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logdriver-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for logdriver-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d0933c952c187746f15b099005cab255d95df4ea0594fa5039329dff1fcddae3
MD5 a8fc2981748684e5f5b1fd01bbf91e15
BLAKE2b-256 16f2a7092bfb281dbb56c37938043f356bc51d27327b4db80d231b23791e612f

See more details on using hashes here.

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