本文整理汇总了Python中lib.reporting.logger.Logger类的典型用法代码示例。如果您正苦于以下问题:Python Logger类的具体用法?Python Logger怎么用?Python Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _find_ctrl
def _find_ctrl(self, parent, name=None, label=None, wxid=None, pos=None, wx_classname=None):
try:
self.find_wx_ctrl(parent, name, label, wxid, pos, wx_classname)
self.find_win_ctrl(parent, name, label, wxid, pos, wx_classname)
except Found, ex:
Logger.add_debug(ex.message)
return
示例2: describe_wxdialog
def describe_wxdialog(self, win, level=0):
if win is None:
return
Logger.newline()
Logger.bold_header("wx Description\n Name: '%s'\n ClassName: '%s'\n Label: '%s'\n Nbr of children: %d" % (win.get_name(), win.get_classname(), win.get_label(), win.get_nbr_of_children()))
if win.get_nbr_of_children() > 0:
self.describe_wxdialog_windows(win)
示例3: _test
def _test(self):
Logger.set_path(self.manuscript.get_log_path())
Logger.set_log_dialog_descriptions(self.appargs.log_dialog_descriptions())
Logger.add_debug("Application arguments")
Logger.add_debug(" ".join(sys.argv))
Logger.add_section("Manuscript", u"%s" % self.manuscript)
instructions = Instructions(self.manuscript, self.appargs.timedelay())
start_app(instructions, self.appargs.program())
示例4: describe
def describe(self, frame):
try:
menu_bar = frame.GetMenuBar()
if menu_bar is not None:
self.describe_menu_bar(menu_bar)
Logger.add(" ")
except AttributeError:
pass
示例5: run
def run(self):
if self.appargs.investigate():
self._log_effective_manuscript()
else:
try:
self._test()
finally:
Logger.log()
return not Logger.has_errors()
示例6: register_dialog
def register_dialog(self, win=None):
if win is None:
return
Logger.add_debug("Registering window: %s" % win)
self.windows.append(win)
if not self.execution_started:
Logger.add_instruction("Execution of instructions start")
self.execution_started = True
wx.CallLater(TIME_TO_WAIT_BEFORE_CONTINUING_IN_MILLISECONDS, self.execute_next_instruction)
示例7: wrap
def wrap(instruction_line, tokens):
try:
rv = f(instruction_line, tokens)
if rv is None:
raise InstructionSyntaxException("")
else:
return rv
except InstructionSyntaxException:
Logger.add_error("Invalid instruction: '%s'. Instruction ignored" % instruction_line)
raise
示例8: find_menu
def find_menu(self, args):
try:
win = wx.GetApp().GetTopWindow()
item_id = self._find_menu_item_id(args)
if item_id != wx.NOT_FOUND:
self.item_id = item_id
raise Found("Menu found")
except Found, ex:
Logger.add_debug(ex.message)
return
示例9: find_win_by_name_or_label
def find_win_by_name_or_label(self, name_or_label):
self.wxctrl = None
self.winctrl = None
try:
if name_or_label is None:
self.wxctrl = wx.GetApp().GetTopWindow()
raise Found("Top window")
for name in name_or_label.split("|"):
name = name.strip()
self.find_wx_win(name, name)
self.find_win_win(name)
except Found, ex:
Logger.add_debug(ex.message)
return
示例10: execute_next_instruction
def execute_next_instruction(self):
try:
instruction = self._next_instruction()
instruction._replace_placeholders()
self._display_instruction_in_popup_window(instruction)
if isinstance(instruction, AddPlaceholderInstruction):
delay = 0
else:
# TODO: We have some timing problem so we can't set
# waiting time to 0. 40 seems to be ok,
delay = max(40, self.timedelay * 1000)
Logger.add_debug("Preparing instruction '%s' for execution with delay %d" % (instruction, delay))
wx.CallLater(delay, self._execute_instruction, instruction)
except NoMoreInstructionsException:
Logger.add_instruction("The last instruction has been executed")
示例11: describe_menu
def describe_menu(self, menu, name):
Logger.add(" ")
Logger.add(" Menu: '%s' Item count: %d" % (name, menu.MenuItemCount))
Logger.add(" Id Label Text")
Logger.add(" ---- ------------------------ ---------------------")
for item in menu.MenuItems:
self.describe_menu_item(item)
if item.SubMenu is not None and item.SubMenu.MenuItemCount > 0:
self.describe_submenu(item.SubMenu)
示例12: __init__
def __init__(self, manuscript, timedelay):
self.timedelay = timedelay
self.popup = None
self.execution_started = False
self.windows = []
self.instructions = []
for line in [
line for line in manuscript.get_instructions() if not line.startswith("#") and len(line.strip()) > 0
]:
try:
instruction = parse(line)
except Exception:
Logger.add_error("Can't parse instruction: '%s'" % line)
raise
if instruction is not None:
self.instructions.append(instruction)
collector = []
for instruction in self.instructions:
collector.append(instruction.to_unicode())
Logger.header("Effective Instructions:\n %s" % "\n ".join(collector))
示例13: describe_children
def describe_children(self, hwnd):
Logger.add(" hwnd Classname ScreenPos Label")
Logger.add(" ------- ------------------------ ------------ ------------------")
children = facade.get_children(hwnd)
for hwnd, class_name, text in children:
rect = facade.get_window_rect(hwnd)
Logger.add(" %8d %-24.24s (%4d, %4d) '%s'" % (hwnd, class_name, rect[0], rect[1], text))
示例14: _validate_windows
def _validate_windows(self):
"""Make sure the topmost window in the list self.windows is still
valid. If not, remove it from the list and continue checking the
list until the list is exhausted or a valid dialog is found.
"""
self.windows.reverse()
while len(self.windows) > 1:
win = self.windows[0]
try:
win.get_label()
try:
if not win.IsShown():
self.windows = self.windows[1:]
else:
break
except:
Logger.add_debug("Window is not visible")
break
except:
Logger.add_debug("get_window_text fails")
self.windows = self.windows[1:]
self.windows.reverse()
示例15: run_python_file
def run_python_file(args):
"""Run a python file as if it were the main program on the command line.
`args` is the argument array to present as sys.argv, including the first
element representing the file being executed.
Lifted straight from coverage.py by Ned Batchelder
"""
try:
# In Py 2.x, the builtins were in __builtin__
BUILTINS = sys.modules['__builtin__']
except KeyError: # pragma: no cover - not worried about Python 3 yet...
# In Py 3.x, they're in builtins
BUILTINS = sys.modules['builtins']
filename = args[0]
# Create a module to serve as __main__
old_main_mod = sys.modules['__main__']
main_mod = imp.new_module('__main__')
sys.modules['__main__'] = main_mod
main_mod.__file__ = filename
main_mod.__builtins__ = BUILTINS
# Set sys.argv and the first path element properly.
old_argv = sys.argv
old_path0 = sys.path[0]
sys.argv = args
sys.path[0] = os.path.dirname(filename)
try:
sys.stdout = open('outfile.txt', 'w')
source = open(filename, 'rU').read()
exec compile(source, filename, "exec") in main_mod.__dict__
except Exception, ex:
Logger.add_error("%s" % ex)
Logger.failure("Exception in application")