def func2(): log.info('func 2') log.debug('raise in func 2') try: func_err() except Exception: log.error('ERROR IN FUNC 2', trace=True)
def runProcs(self): log.info("Detach processes ...") p = list() p.append("C:\\work\\scenes\\vray\\test\\cubes.vrscene") p.append("C:\\work\\scenes\\vray\\test\\sphere.vrscene") for i in range(self.numTest): for path in p: name = FileSystem.name(path) + '_' + str(i) self.detach(name, path)
def bench_logs(num_pass=30000): print "... bench logging" times = dict() msg = "{0} - {1} - this is a print iteration, please ignore this message" key = 'simple' print "... simple print" start = datetime.now() for i in xrange(num_pass): print msg.format(key, i) times[key] = datetime.now() - start os.environ['DEBUG_LOGFILE'] = '' key = 'log' print "... log print" start = datetime.now() for i in xrange(num_pass): log.info(msg, key, i) times[key] = datetime.now() - start key = 'passed' print "... log ignored" start = datetime.now() for i in xrange(num_pass): log.debug3(msg, key, i) times[key] = datetime.now() - start os.environ['DEBUG_LOGFILE'] = 'C:/work/test.log' key = 'file' print "... log to file" start = datetime.now() for i in xrange(num_pass): log.info(msg, key, i) times[key] = datetime.now() - start print "" print "-" * 40 for k, v in times.iteritems(): print str(k) + ' = ' + str(v)
def main(): environment.fakeApp(texts.appNameHoudini) log.info('Launching {0} server ...', connectortools.getCurrentApp()) server = ApplicationServer() #log.debug('Session link : {0}', server.probeSession()) #server.probeAsync() ''' server.handle(TEST_EVENTS.SOME_EVENT, server.do_some_event) server.client.watch(server.card(), TEST_EVENTS.SOME_EVENT) server.client.hello() server.client.hi('detached call') server.client.hey(server.card(server.hey_done), 'async call') ''' try: while True: #log.debug('... out loop') time.sleep(1) except KeyboardInterrupt: print '... keyboard interrupt !' server.stopWatchDog() raise
def func_err(): log.info('func err') raise RuntimeError('some random error')
if event == "return": print "<" + "-" * indent[0], "exit function", frame.f_code.co_name indent[0] -= 2 return tracefunc sys.settrace(tracefunc) ''' __import__('scramble') from cgev.common import log from cgev.rpc.test import TestClient client = TestClient() log.info('-> hello') log.debug(client.hello()) log.info('-> hi') log.debug(client.hi('yooooo')) delay = int(sys.argv[1]) if len(sys.argv) > 1 else None log.info('-> hey {0}', delay) log.debug(client.hey(None, delay)) ''' while 1: log.info('-> sync {0}', delay) log.debug(client.func_sync(delay)) '''
def test_shell(): log.info("single call") log.info("got: {0}", system.shell(__file__ + ' "single result" 2')) log.info("multi call") cmd = __file__ + ' "multi result 1" 2; ' cmd += __file__ + ' "multi result 2" 2 err' for out in system.shell(cmd): log.info("got: {0}", out) log.info("single background call") cmd = __file__ + ' "background result" 2' log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.BACKGROUND)) log.info("multi background call") cmd = __file__ + ' "background result 1" 2; ' cmd += __file__ + ' "background result 2" 3 err' log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.BACKGROUND)) log.info("single streamed call") cmd = __file__ + ' "single streamed" 2' log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.LOGGED)) log.info("multi streamed call") cmd = __file__ + ' "streamed 1" 2; ' + __file__ + ' "streamed 2" 2 err' log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.LOGGED))
def stopProcs(self): log.info("Stop processes ...") self.pool.stop()