diff --git a/mongolog/handlers.py b/mongolog/handlers.py index d9a7cb4..f203c4d 100644 --- a/mongolog/handlers.py +++ b/mongolog/handlers.py @@ -50,8 +50,7 @@ def __init__(self, level=NOTSET, connection=None, w=1, j=False, verbose=None, ti # Used to determine which time setting is used in the simple record_type self.time_zone = time_zone - # If True will print each log_record to console before logging to mongo - # Useful for debugging since "func" will provides name of test method. + # If True will print each log_record to console before writing to mongo self.verbose = verbose if not self.connection: @@ -59,14 +58,14 @@ def __init__(self, level=NOTSET, connection=None, w=1, j=False, verbose=None, ti print("Will try to connect with default") # Set a defaul connection key - self.connection = 'mongodb://localhost:27017/' + self.connection = u'mongodb://localhost:27017/' self.connect() return super(BaseMongoLogHandler, self).__init__(level) def __unicode__(self): - return self.connection + return u'%s' % self.connection def __str__(self): return self.__unicode__() @@ -109,7 +108,8 @@ def get_collection(self): def create_log_record(self, record): """ - + Override in subclasses to change log record formatting. + See SimpleMongoLogHandler and VerboseMongoLogHandler """ return LogRecord(json.loads(json.dumps(record.__dict__, default=str)))