예제 #1
0
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None):
    """Log some information

    The required arguments are:

      subsystem -- The subsystem generating the message (e.g. ZODB)

      severity -- The "severity" of the event.  This may be an integer or
                  a floating point number.  Logging back ends may
                  consider the int() of this value to be significant.
                  For example, a backend may consider any severity
                  whos integer value is WARNING to be a warning.

      summary -- A short summary of the event

      detail -- A detailed description

      error -- A three-element tuple consisting of an error type, value, and
               traceback.  If provided, then a summary of the error
               is added to the detail.

      reraise -- If provided with a true value, then the error given by
                 error is reraised.

    """
    log_write(subsystem, severity, summary, detail, error)
    if reraise and error:
        raise fmt_raise(error)
예제 #2
0
파일: test_logging.py 프로젝트: jean/zLOG
 def test_log_record(self):
     #log_write(subsystem, severity, summary, detail, error)
     log_write("sample.subsystem", zLOG.WARNING, "summary", "detail", None)
     self.assertEqual(len(self.records), 1)
     record = self.records[0]
     self.assertEqual(record.levelno, logging.WARN)
     self.assertEqual(record.name, "sample.subsystem")
     # Make sure both the message and the detail information appear
     # in the text that gets logged:
     record.msg.index("summary")
     record.msg.index("detail")
예제 #3
0
 def test_log_record(self):
     #log_write(subsystem, severity, summary, detail, error)
     log_write("sample.subsystem", zLOG.WARNING, "summary", "detail", None)
     self.assertEqual(len(self.records), 1)
     record = self.records[0]
     self.assertEqual(record.levelno, logging.WARN)
     self.assertEqual(record.name, "sample.subsystem")
     # Make sure both the message and the detail information appear
     # in the text that gets logged:
     record.msg.index("summary")
     record.msg.index("detail")
예제 #4
0
 def log(self, short="", longMessage="", error_level=zLOG.INFO, reraise=0):
     "Log an error to a file"
     log_write(self.getId(), error_level, str(short), str(longMessage),
               None)
예제 #5
0
def log(name, short="", longMessage="", error_level=zLOG.INFO, reraise=0):
    "Log an error to a file"
    log_write(name, error_level, str(short), str(longMessage), None)