Include name and levelno attributes in DDP emitted log records.

This commit is contained in:
Tyson Clugg 2015-09-18 17:43:23 +10:00
parent 61e5d8dcf8
commit f756ec445f

View file

@ -6,17 +6,10 @@ import logging
from dddp import THREAD_LOCAL as this, meteor_random_id, ADDED
class DDPHandler(logging.Handler):
"""Logging handler that streams log events via DDP to the current client."""
def __init__(self, *args, **kwargs):
self.logger = logging.getLogger('django.db.backends')
self.logger.info('Test')
super(DDPHandler, self).__init__(*args, **kwargs)
def emit(self, record):
"""Emit a formatted log record via DDP."""
if getattr(this, 'subs', {}).get('Logs', False):
@ -25,8 +18,8 @@ class DDPHandler(logging.Handler):
'collection': 'logs',
'id': meteor_random_id('/collection/logs'),
'fields': {
# 'name': record.name,
# 'levelno': record.levelno,
'name': record.name,
'levelno': record.levelno,
'levelname': record.levelname,
# 'pathname': record.pathname,
# 'lineno': record.lineno,