gale.log.graylog_handler module
This file contains the implementation of the class GraylogHandler: a logging.Handler that sends each log record to a Graylog server as a GELF (Graylog Extended Log Format) datagram over UDP.
Author: Alejandro Mujica (aledrums@gmail.com)
- class gale.log.graylog_handler.GraylogHandler(host, port, source=None)[source]
Bases:
HandlerSends every log record to a Graylog server as a GELF (Graylog Extended Log Format) datagram over UDP — one strategy among possibly several; register it with gale.log.add_handler to start sending records there in addition to (or, with gale.log.configure(console=False, log_file=None), instead of) the console/file defaults. Any other logging.Handler works exactly the same way, GraylogHandler is just the one gale ships since the standard library doesn’t have one.
Usage example:
from gale.log import add_handler from gale.log.graylog_handler import GraylogHandler
add_handler(GraylogHandler(“graylog.example.com”, 12201))
- Parameters:
host (str)
port (int)
source (str | None)