Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (20 sloc) 580 Bytes
import sys
import logging
import graypy
logger = logging.getLogger('frontik')
logger.setLevel(logging.DEBUG)
handler = graypy.GELFHandler('127.0.0.1', 12201, debugging_fields=False)
logger.addHandler(handler)
def process_line(l):
guts = l.split()
level = guts[3]
request_id = guts[4].split('.')[-1][:32]
assert len(request_id) == 32
message = ' '.join(guts[5:])
adapter = logging.LoggerAdapter(logger, {'request_id': request_id})
getattr(adapter, level.lower())(message)
for l in sys.stdin:
try:
process_line(l)
except:
pass