예제 #1
0
"""
Simple program for unit tests of BXI Log Python library.
See testparserconf.py for details.
"""

import bxi.base.log as bxilog

import bxi.base.posless as posless
import bxi.base.parserconf as bxiparserconf

if __name__ == "__main__":

    parser = posless.ArgumentParser(
        description='Unit Testing ParserConf',
        formatter_class=bxiparserconf.FilteredHelpFormatter)
    bxiparserconf.addargs(parser)
    args = parser.parse_args()

    bxilog.panic("A panic message")
    bxilog.alert("An alert message")
    bxilog.critical("A critical message")
    bxilog.error("An error message")
    bxilog.warning("A warning message")
    bxilog.notice("A notice message")
    bxilog.output("An output message")
    bxilog.info("An info message")
    bxilog.debug("A debug message")
    bxilog.fine("A fine message")
    bxilog.trace("A trace message")
    bxilog.lowest("A lowest message")
예제 #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Author: Pierre Vignéras <*****@*****.**>
###############################################################################
# Copyright (C) 2013  Bull S. A. S.  -  All rights reserved
# Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
# This is not Free or Open Source software.
# Please contact Bull S. A. S. for details about its license.
###############################################################################
"""
Simple program for unit tests of BXI Log Python library.
See testbxilog.py for details.
"""

import os

import bxi.base.log as bxilog

import __main__

basename = os.path.basename(__main__.__file__)
FILENAME = "%s.bxilog" % os.path.splitext(basename)[0]

if __name__ == "__main__":
    bxilog.basicConfig(filename=FILENAME, level=bxilog.TRACE)

    bxilog.output(
        "Will raise an exception without any try/except, log must catch it")
    raise ValueError("Normal: this must appears in the file")
# -*- coding: utf-8 -*-
###############################################################################
# Author: Pierre Vignéras <*****@*****.**>
###############################################################################
# Copyright (C) 2013  Bull S. A. S.  -  All rights reserved
# Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
# This is not Free or Open Source software.
# Please contact Bull S. A. S. for details about its license.
###############################################################################
"""
Simple program for unit tests of BXI Log Python library.
See testbxilog.py for details.
"""

import os, time, signal

import bxi.base.log as bxilog

import __main__

basename = os.path.basename(__main__.__file__)
FILENAME = "%s.bxilog" % os.path.splitext(basename)[0]

if __name__ == "__main__":
    bxilog.basicConfig(filename=FILENAME)

    bxilog.output("Logging a message")
    while True:
        bxilog.output("Waiting until killed")
        time.sleep(2.5)
예제 #4
0
 def test_strange_char(self):
     """Test logging with non-printable character, and especially, NULL char"""
     for i in xrange(256):
         bxilog.output(
             "A message with ascii character %d just between "
             "the two following quotes '%s'", i, chr(i))