web/contentment/util/logging.py
def format(self, record):
		"""Formats LogRecord into a MongoEngine Log instance."""
		
		document = Log(
				service = record.name,
				level = record.levelno,
				message = record.getMessage(),  # TODO: Raw w/ positional if possible.
				
				time = datetime.fromtimestamp(record.created),
				process = LogRuntime(identifier=record.process, name=record.processName),
				thread = LogRuntime(identifier=record.thread, name=record.threadName),
				location = LogLocation(
						path = record.pathname,
						line = record.lineno,
						module = record.module,
						function = record.funcName
					)
			)
		
		if record.exc_info is not None:
			document.exception = LogException(
					message = str(record.exc_info[1]),
					trace = self.formatException(record.exc_info)
				)
		
		# Standard document decorated with extra contextual information
		
		if len(Log.DEFAULT_PROPERTIES) != len(record.__dict__):
			extras = set(record.__dict__).difference(set(Log.DEFAULT_PROPERTIES))
			for name in extras:
				setattr(document.data, name, record.__dict__[name])
		
		return document
Formats LogRecord into a MongoEngine Log instance.
Formats LogRecord into a MongoEngine Log instance.
Formats LogRecord into a MongoEngine Log instance .
def format(self, record):
		document = Log(
				service = record.name,
				level = record.levelno,
				message = record.getMessage(),  
				time = datetime.fromtimestamp(record.created),
				process = LogRuntime(identifier=record.process, name=record.processName),
				thread = LogRuntime(identifier=record.thread, name=record.threadName),
				location = LogLocation(
						path = record.pathname,
						line = record.lineno,
						module = record.module,
						function = record.funcName
					)
			)
		if record.exc_info is not None:
			document.exception = LogException(
					message = str(record.exc_info[1]),
					trace = self.formatException(record.exc_info)
				)
		if len(Log.DEFAULT_PROPERTIES) != len(record.__dict__):
			extras = set(record.__dict__).difference(set(Log.DEFAULT_PROPERTIES))
			for name in extras:
				setattr(document.data, name, record.__dict__[name])
		return document
def format ( self , record ) : document = Log ( service = record . name , level = record . levelno , message = record . getMessage ( ) , time = datetime . fromtimestamp ( record . created ) , process = LogRuntime ( identifier = record . process , name = record . processName ) , thread = LogRuntime ( identifier = record . thread , name = record . threadName ) , location = LogLocation ( path = record . pathname , line = record . lineno , module = record . module , function = record . funcName ) ) if record . exc_info is not None : document . exception = LogException ( message = str ( record . exc_info [ 1 ] ) , trace = self . formatException ( record . exc_info ) ) if len ( Log . DEFAULT_PROPERTIES ) != len ( record . __dict__ ) : extras = set ( record . __dict__ ) . difference ( set ( Log . DEFAULT_PROPERTIES ) ) for name in extras : setattr ( document . data , name , record . __dict__ [ name ] ) return document
Formats LogRecord into a MongoEngine Log instance.
Formats LogRecord into a MongoEngine Log instance .
"""Formats LogRecord into a MongoEngine Log instance.""" # TODO: Raw w/ positional if possible. # Standard document decorated with extra contextual information
self
record