安装:
pip install graypy
依赖的安装包:
pip install graypy[amqp]
简单使用:
import logging
import graypy
my_logger = logging.getLogger('test_logger')
my_logger.setLevel(logging.DEBUG)
handler = graypy.GELFUDPHandler('localhost', 12201)
my_logger.addHandler(handler)
my_logger.debug('Hello Graylog.')
详见官方文档:graypy — graypy 1.2.0 documentation