def emit(self, record):
"""Log an error to the datastore, if applicable.
Args:
The logging.LogRecord object.
See http://docs.python.org/library/logging.html#logging.LogRecord
"""
try:
if not record.exc_info:
return
signature = self.__GetSignature(record.exc_info)
old_namespace = namespace_manager.get_namespace()
try:
namespace_manager.set_namespace('')
if not memcache.add(signature, None, self.log_interval):
return
db.run_in_transaction_custom_retries(1, self.__EmitTx, signature,
record.exc_info)
finally:
namespace_manager.set_namespace(old_namespace)
except Exception:
self.handleError(record)
评论列表
文章目录