Exemplo n.º 1
0
def warningMessage(warningstr):
    import ctx_log

    lineno = inspect.currentframe().f_back.f_lineno
    filename = inspect.currentframe().f_back.f_code.co_filename
    msg = " (%s:%d):  %s\n"%(os.path.basename(filename),  lineno, warningstr)
    logging.warning(msg)


    # Include warning messages in logfile
    ctx_log.ctxlogAddMessage( msg )
Exemplo n.º 2
0
def infoMessage(msg, msgVerboseLevel=0):
    import ctx_log

    global globalVerboseLevel

    if globalVerboseLevel == 0 or globalVerboseLevel < msgVerboseLevel:
        return

    lineno = inspect.currentframe().f_back.f_lineno
    filename = inspect.currentframe().f_back.f_code.co_filename
    msg = " (%s:%d):  %s\n"%(os.path.basename(filename),   lineno, msg)
    logging.info(msg)

    # Include info messages in log when verbose level is higher than standard
    if globalVerboseLevel > 1:
        ctx_log.ctxlogAddMessage( msg )
Exemplo n.º 3
0
def warningMessage(warningstr):
    import ctx_log

    lineno = inspect.currentframe().f_back.f_lineno
    filename = inspect.currentframe().f_back.f_code.co_filename
    msg = " (%s:%d):  %s\n"%(os.path.basename(filename),  lineno, warningstr)
    emitHandler = logging.StreamHandler.emit
    if sys.platform == 'win32':
        # Windows does not support ANSI escapes and we are using API calls to set the console color
        logging.StreamHandler.emit = add_windows_warn_color(logging.StreamHandler.emit)
    else:
        # all non-Windows platforms are supporting ANSI escapes so we use them
        logging.StreamHandler.emit = add_ansi_warn_color(logging.StreamHandler.emit)


    logging.warning(msg)

    # reset emithandler
    logging.StreamHandler.emit = emitHandler


    # Include warning messages in logfile
    ctx_log.ctxlogAddMessage( msg )