Skip to main content

Python logging handler that sends messages in GELF (Graylog Extended Log Format).

Project description

Installing

Using easy_install:

easy_install graypy

Usage

Messages are sent to Graylog2 using a custom handler for the builtin logging library in GELF format:

import logging
import graypy

my_logger = logging.getLogger('test_logger')
my_logger.setLevel(logging.DEBUG)

handler = graypy.GELFHandler('localhost', 12201)
my_logger.addHandler(handler)

my_logger.debug('Hello Graylog2.')

Tracebacks are added as full messages:

import logging
import graypy

my_logger = logging.getLogger('test_logger')
my_logger.setLevel(logging.DEBUG)

handler = graypy.GELFHandler('localhost', 12201)
my_logger.addHandler(handler)

try:
    puff_the_magic_dragon()
except NameError:
    my_logger.debug('No dragons here.', exc_info=1)

Custom fields

A number of custom fields are automatically added if available:
  • function

  • pid

  • process_name

  • thread_name

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

graypy-0.2.1.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file graypy-0.2.1.tar.gz.

File metadata

  • Download URL: graypy-0.2.1.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for graypy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8b30f98159937237cf49046e0ce3ec018dc0f526eea4985ffa4c8f26cf3c3b42
MD5 36331dbed1cc17edfa6f7e732725a70f
BLAKE2b-256 60832ae4c0a5af05d8d453591c14e968148ca0e2ed8767e70c4ee883c58a6e22

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