Example #1
0
 def get_logs(self):
     try:
         handler = get_handler(get_logger(None), "memory")
         return str(handler.get_buffer(MAX_LOG_DISPLAYED))
     except Exception as e:
         log.exception(e)
         return None
Example #2
0
 def get_logs(self):
     try:
         handler = get_handler(get_logger(None), "memory")
         return str(handler.get_buffer(MAX_LOG_DISPLAYED))
     except Exception as e:
         log.exception(e)
         return None
Example #3
0
 def _export_logs(self):
     logs = ""
     logger = get_logger(None)
     handler = get_handler(logger, "memory")
     log_buffer = handler.get_buffer(MAX_LOG_DISPLAYED)
     for record in log_buffer:
         logs = logs + handler.format(record) + "\n"
     return logs
Example #4
0
 def _get_logs(self, limit=MAX_LOG_DISPLAYED):
     logs = []
     handler = get_handler(get_logger(None), "memory")
     log_buffer = handler.get_buffer(limit)
     for record in log_buffer:
         logs.append(self._export_log_record(record))
         limit = limit - 1
         if limit == 0:
             return logs
     return logs
Example #5
0
 def _get_logs(self, limit=MAX_LOG_DISPLAYED):
     logs = []
     handler = get_handler(get_logger(None), "memory")
     log_buffer = handler.get_buffer(limit)
     for record in log_buffer:
         logs.append(self._export_log_record(record))
         limit = limit - 1
         if limit == 0:
             return logs
     return logs
Example #6
0
 def _export_logs(self):
     logs = u""
     logger = get_logger(None)
     handler = get_handler(logger, "memory")
     log_buffer = handler.get_buffer(MAX_LOG_DISPLAYED)
     for record in log_buffer:
         try:
             log = handler.format(record).decode("utf-8", errors="replace")
         except UnicodeEncodeError:
             log = handler.format(record)
         logs = logs + log + u"\n"
     return logs
Example #7
0
 def _export_logs(self):
     logs = u""
     logger = get_logger(None)
     handler = get_handler(logger, "memory")
     log_buffer = handler.get_buffer(MAX_LOG_DISPLAYED)
     for record in log_buffer:
         try:
             log = handler.format(record).decode("utf-8", errors="replace")
         except UnicodeEncodeError:
             log = handler.format(record)
         logs = logs + log + u"\n"
     return logs
Example #8
0
    def _export_logs():
        """
        Export all lines from the memory logger.

        :return bytes: bytes needed by zipfile.writestr()
        """

        logger = get_logger(None)
        handler = get_handler(logger, 'memory')
        log_buffer = handler.get_buffer(MAX_LOG_DISPLAYED)

        for record in log_buffer:
            line = handler.format(record)
            if not isinstance(line, bytes):
                line = line.encode('utf-8', errors='replace')
            yield line
Example #9
0
    def _export_logs():
        """
        Export all lines from the memory logger.

        :return bytes: bytes needed by zipfile.writestr()
        """

        logger = get_logger(None)
        handler = get_handler(logger, 'memory')
        log_buffer = handler.get_buffer(MAX_LOG_DISPLAYED)

        for record in log_buffer:
            line = handler.format(record)
            if not isinstance(line, bytes):
                line = line.encode('utf-8', errors='replace')
            yield line