本文整理汇总了Python中OpenIPMI.set_log_handler方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI.set_log_handler方法的具体用法?Python OpenIPMI.set_log_handler怎么用?Python OpenIPMI.set_log_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenIPMI
的用法示例。
在下文中一共展示了OpenIPMI.set_log_handler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quit
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import set_log_handler [as 别名]
def quit(self):
del self.mc
OpenIPMI.set_log_handler(DummyLogHandler())
OpenIPMI.shutdown_everything()
print "done"
sys.exit(0)
return
示例2: quit
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import set_log_handler [as 别名]
def quit(self):
global shutdown_thread
shutdown_thread = True;
gui_cmdwin._HistorySave(self.histfile)
OpenIPMI.set_log_handler(DummyLogHandler())
OpenIPMI.shutdown_everything()
if (self.debug_mem):
print "OpenIPMI is shutdown, memory problems (SEGVs) after this"
print " are likely due to OpenIPMI data not being freed until"
print " after this point due to the python garbage collector"
pass
sys.exit()
return
示例3: log
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import set_log_handler [as 别名]
event = mc.next_event(event)
pass
return
def log(self, level, log):
print level + ": " + log
return
pass
OpenIPMI.enable_debug_malloc()
OpenIPMI.init_posix()
main_handler = Handlers("hello")
OpenIPMI.set_log_handler(main_handler)
a = OpenIPMI.open_domain2("test", sys.argv[1:], main_handler, main_handler)
if not a:
print "open failed"
sys.exit(1)
pass
del a
while main_handler.name != "done":
OpenIPMI.wait_io(1000)
pass
class DummyLogHandler:
def __init__(self):
pass
示例4: run
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import set_log_handler [as 别名]
#.........这里部分代码省略.........
if (arg == "--dmsg"):
debug_msg = True
elif (arg == "--drawmsg"):
debug_msg = True
elif (arg == "--dmem"):
debug_mem = True
elif (arg == "--verbose"):
verbosity += 1
elif (arg == "--trace"):
do_trace = True
elif (arg == "--logstderr"):
log_file = sys.stderr
elif (arg == "--logstdout"):
log_file = sys.stdout
elif (arg == "-n"):
read_preffile = False
elif (arg == '-p'):
if (len(args) == 0):
print "No argument given for -p";
return
preffile = args[carg]
carg += 1
else:
print "Unknown argument: " + arg
return
pass
if (debug_mem):
OpenIPMI.enable_debug_malloc()
pass
top = TopHandler(preffile, log_file, histfile)
# Detect if we need a separate OpenIPMI driver thread. See the
# openipmi_driver function above for the reason.
try:
import thread
try:
top.tk.getvar("tcl_platform", "threaded")
# Tcl is threaded, no need for another thread.
need_separate_openipmi_thread = False
except:
# Python is threaded, but Tcl is not. Need to run the
# OpenIPMI event loop in another thread.
need_separate_openipmi_thread = True
pass
pass
except:
# No thread support, can't use another thread.
need_separate_openipmi_thread = False
pass
if (need_separate_openipmi_thread):
if (verbosity >= 1):
print "Creating separate OpenIPMI event driver thread"
pass
OpenIPMI.init()
thread.start_new_thread(openipmi_driver, ())
pass
else:
if (verbosity >= 1):
print "Using TCL event loop, no threads"
pass
OpenIPMI.init_tcl()
pass
if (debug_rawmsg):
OpenIPMI.enable_debug_rawmsg()
pass
if (debug_msg):
OpenIPMI.enable_debug_msg()
pass
if (do_trace):
sys.settrace(trace)
pass
if (read_preffile):
_saveprefs.restore(preffile)
gui_cmdwin._HistoryRestore(histfile)
mainhandler = top
OpenIPMI.add_domain_change_handler(_domain.DomainWatcher(mainhandler))
mainhandler.debug_mem = debug_mem
top.title('OpenIPMI GUI')
ui = gui.IPMIGUI(top, mainhandler)
mainhandler.SetUI(ui)
OpenIPMI.add_domain_change_handler(mainhandler)
OpenIPMI.set_log_handler(mainhandler)
_domain.RestoreDomains(mainhandler)
OpenIPMI.set_cmdlang_event_handler(CmdlangEventHandler(mainhandler))
top.mainloop()
mainhandler.quit()
示例5: __init__
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import set_log_handler [as 别名]
return
class DummyLogHandler:
def __init__(self):
pass
def log(self, level, log):
sys.stderr.write(level + ": " + log + "\n")
OpenIPMI.enable_debug_malloc()
OpenIPMI.init_posix()
main_handler = Handlers("hello")
OpenIPMI.set_log_handler(main_handler)
a = OpenIPMI.open_domain2("test", ["-noall",] + sys.argv[1:],
main_handler, main_handler)
if not a:
print "open failed"
sys.exit(1)
pass
del a
nexttime = time.time()
num_poll = 1
while main_handler.name != "done" and num_poll <= 2:
OpenIPMI.wait_io(1000)
now = time.time()
if main_handler.mc and now >= nexttime: