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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: logdriver-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 df486c090265adc0412c81ad296cde76666146ca2f92df321b042179f819375e
MD5 9ecf372d0361ef57f0ba37e26cca883c
BLAKE2b-256 5ef316f651fc2252325313041684a0c763753bc283336b5618fb7b41e45b1599

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: logdriver-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e78cf0265bd2635c8e93e5194bad8b85b6481c4e8034c9b3856421f79cca85ff
MD5 46bda500809e5bff87dfa2162b7788cf
BLAKE2b-256 9300210138364c16e1b908231066d68143198229299d3d01245c454e794bb6f2

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