Пример #1
0
def test_func5():
    b = 0
    try:
        b= test_func2()
    except Exception as ex:
        Log.error("test_func2 error", None, ex)
        print '='*20
        s = test_trace()
        print s
        print '='*20
        raise

    print b
Пример #2
0
def test_func3():
    b = 0
    try:
        b= test_func2()
    except Exception as ex:
        Log.error("test_func2 error", None, ex)
        print '='*20
        s = StringIO.StringIO()
        traceback.print_exc(file = s)
        print s.getvalue()
        print '='*20
        raise

    print b
Пример #3
0
def email_error(ex, msg='', level=3, tolog=True):
    if tolog:
        Log.error(msg, None, ex)
    ex_msg = exception2unicode(ex)
    if msg:
        msg = u"%s\n%s" % (msg, ex_msg)
    else:
        msg = ex_msg
    tb_msg = traceback_message()
        
    message = """
    %s\n\n
    %s\n
    %s\n
    %s\n
    """ % (msg, '-'*20, tb_msg, '-'*20)
    
    email_message(message, level)
Пример #4
0
def test_func1():
    '''
    test_func1 name
    '''
    Log.debug('it is debug')
    Log.info('it is info')
    
    Log.warn('it is warn')
    
    Log.error('it is error')
    
    Log.debug('it is debug')
    Log.info('it is info')
    
    Log.warn('it is warn')
    
    Log.error('it is error')
    
    Log.live("it is live")