示例#1
0
    def test_logging_bg(self):
        logger = logging.getLogger("GMailBackgroundLogger")
        logger.setLevel(logging.DEBUG)

        gh = GMailHandler(os.environ["GMAIL_ACCOUNT"], os.environ["GMAIL_PASSWD"], os.environ["GMAIL_RCPT"], True)

        gh.setLevel(logging.DEBUG)
        logger.addHandler(gh)

        logger.error("Background Error Message")

        gh.close()
示例#2
0
    def test_logging(self):
        logger = logging.getLogger("GMailLogger")
        logger.setLevel(logging.DEBUG)

        gh = GMailHandler(os.environ["GMAIL_ACCOUNT"], os.environ["GMAIL_PASSWD"], os.environ["GMAIL_RCPT"], False)

        gh.setLevel(logging.DEBUG)
        logger.addHandler(gh)

        logger.debug("Debug Message")
        logger.info("Info Message")
        logger.warn("Warn Message")
        logger.error("Error Message")

        try:
            1 / 0
        except Exception, e:
            logger.exception(e)
示例#3
0
    def test_logging(self):
        logger = logging.getLogger("GMailLogger")
        logger.setLevel(logging.DEBUG)

        gh = GMailHandler(os.environ['GMAIL_ACCOUNT'],
                          os.environ['GMAIL_PASSWD'],
                          os.environ['GMAIL_RCPT'],
                          False)

        gh.setLevel(logging.DEBUG)
        logger.addHandler(gh)

        logger.debug("Debug Message")
        logger.info("Info Message")
        logger.warn("Warn Message")
        logger.error("Error Message")

        try:
            1/0
        except Exception,e:
            logger.exception(e)
示例#4
0
    def test_logging_bg(self):
        logger = logging.getLogger("GMailBackgroundLogger")
        logger.setLevel(logging.DEBUG)

        gh = GMailHandler(os.environ['GMAIL_ACCOUNT'],
                          os.environ['GMAIL_PASSWD'],
                          os.environ['GMAIL_RCPT'],
                          True)

        gh.setLevel(logging.DEBUG)
        logger.addHandler(gh)

        logger.error("Background Error Message")

        gh.close()