Skip to main content

A light-weight socket log receiver

Project description

pyversion Status CircleCI Coverage Status Code style: black

Socket Log Receiver

socket_log_receiver is a light-weight socket log receiver. It runs as a server and aggregates messages from multi-process application via socket and logs to a single file. Python's logging package does not support logging to a single file from multiple processes. By pointing SocketHandler to socket_log_receiver, the multi-process application can log to a single file.

Installation

$ pip install socket-log-receiver

Basic Usage

The receiver service should be run as a service.

$ python -m socket_log_receiver  # as a module
$ log_receiver                   # as a command-line program

In the application, use SocketHandler to send logs to the receiver service.

from logging.handlers import SocketHandler

handler = SocketHandler('localhost', 9020)  # handler to send logs to localhost:9020
logging.root.addHandler(handler)            # add the socket handler to the root logger

This way, the root logger sends logging messages to the receiver service.

Development

$ pip install -e .[dev]
$ pre-commit install

Running Tests

$ python setup.py tests

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

socket-log-receiver-20.4.1a0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

socket_log_receiver-20.4.1a0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file socket-log-receiver-20.4.1a0.tar.gz.

File metadata

  • Download URL: socket-log-receiver-20.4.1a0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for socket-log-receiver-20.4.1a0.tar.gz
Algorithm Hash digest
SHA256 3eda114c58c934c25b7bf2e7ad5f0091f4429b80211a18e61ba256cc4808da01
MD5 d2ffff1a50d360e9faa267f4d0f79d97
BLAKE2b-256 7a5cf2c0e920bd8eaf5fbf82d0dbc37a27c06541916b469746eda5ebc40ed625

See more details on using hashes here.

File details

Details for the file socket_log_receiver-20.4.1a0-py3-none-any.whl.

File metadata

  • Download URL: socket_log_receiver-20.4.1a0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for socket_log_receiver-20.4.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 21e5426d4c8afd3e33e05ce732fbfcb24a6c3805bca060efbe9a2abe5be5fdbd
MD5 0aab99f58b4cdca30d5188a1a6fe6162
BLAKE2b-256 3fb57b0901b294205ce79eb780c0b43f8f315209a2226522d72a31a4df20c315

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