当前位置: 首页>>代码示例>>Python>>正文


Python logger.log函数代码示例

本文整理汇总了Python中mufsim.logger.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_muv

 def process_muv(self, infile):
     tmpfile = infile
     if tmpfile[-4:] == ".muv":
         tmpfile = tmpfile[:-1] + 'f'
     else:
         tmpfile += ".muf"
     if "MufSim.app/Contents/Resources" in os.getcwd():
         muvdir = os.path.join(os.getcwd(), "muv")
         cmdarr = [
             os.path.join(muvdir, "muv"),
             "-I", os.path.join(muvdir, "incls"),
             "-o", tmpfile,
             infile
         ]
     else:
         cmdarr = ["muv", "-o", tmpfile, infile]
     p = Popen(cmdarr, stdout=PIPE, stderr=PIPE)
     outdata, errdata = p.communicate()
     outdata = outdata.decode()
     errdata = errdata.decode()
     for line in outdata.split("\n"):
         if line:
             log(line)
     for line in errdata.split("\n"):
         if line:
             errlog(line)
     if p.returncode != 0:
         errlog("MUV compilation failed!")
         return None
     log("MUV compilation successful.", msgtype="good")
     return tmpfile
开发者ID:gitter-badger,项目名称:mufsim,代码行数:31,代码来源:mufgui.py

示例2: show_compiled_tokens

 def show_compiled_tokens(self, prog):
     alltokens = self.fr.program_tokens(prog)
     for inum, tokeninfo in enumerate(alltokens):
         rep = tokeninfo['repr']
         if inum > 0 and rep.startswith("Function:"):
             log("")
         log("% 5d: %s" % (inum, rep))
开发者ID:revarbat,项目名称:mufsim,代码行数:7,代码来源:__init__.py

示例3: compile

 def compile(self, cmplr, code, src):
     nam, src = cmplr.get_word(src)
     comp = cmplr.compiled
     if not comp.publicize_function(nam):
         raise MufCompileError("Unrecognized identifier: %s" % nam)
     log("EXPOSED '%s' AS PUBLIC" % nam)
     return (False, src)
开发者ID:revarbat,项目名称:mufsim,代码行数:7,代码来源:flow.py

示例4: execute

 def execute(self, fr):
     con = fr.data_pop(int)
     descr = conn.descr_from_con(con)
     if descr >= 0:
         who = conn.descr_user(descr)
         conn.disconnect(descr)
         log("BOOTED DESCRIPTOR %d: %s" % (descr, db.getobj(who)))
开发者ID:gitter-badger,项目名称:mufsim,代码行数:7,代码来源:connections.py

示例5: debug_cmd_print

 def debug_cmd_print(self, args):
     addr = self.fr.curr_addr()
     vname = args
     muvname = ("_%s" % vname).replace("::", "__")
     fun = self.fr.program_find_func(addr)
     if self.fr.program_func_var(addr.prog, fun, vname):
         v = self.fr.program_func_var(addr.prog, fun, vname)
         val = self.fr.funcvar_get(v)
     elif self.fr.program_global_var(addr.prog, vname):
         v = self.fr.program_global_var(addr.prog, vname)
         val = self.fr.globalvar_get(v)
     elif self.fr.program_func_var(addr.prog, fun, muvname):
         v = self.fr.program_func_var(addr.prog, fun, muvname)
         val = self.fr.funcvar_get(v)
         vname = muvname
     elif self.fr.program_global_var(addr.prog, muvname):
         v = self.fr.program_global_var(addr.prog, muvname)
         val = self.fr.globalvar_get(v)
         vname = muvname
     else:
         log("Variable not found: %s" % vname)
         val = None
     if val is not None:
         val = si.item_repr(val)
         log("%s = %s" % (vname, val))
开发者ID:revarbat,项目名称:mufsim,代码行数:25,代码来源:__init__.py

示例6: execute

 def execute(self, fr):
     # TODO: make real timed read.
     fr.data_pop(int)
     while True:
         if fr.text_entry:
             txt = fr.text_entry.pop(0)
         else:
             fr.wait_state = fr.WAIT_READ
             raise MufBreakExecution()
         if txt or fr.read_wants_blanks:
             break
         log("Blank line ignored.")
     if txt == "@T":
         log("Faking time-out.")
         fr.data_push("")
         fr.data_push(1)
     elif txt == "@Q":
         while fr.call_stack:
             fr.call_pop()
         while fr.catch_stack:
             fr.catch_pop()
         raise MufRuntimeError("Aborting program.")
     else:
         fr.data_push(txt)
         fr.data_push(0)
开发者ID:gitter-badger,项目名称:mufsim,代码行数:25,代码来源:io.py

示例7: debug_cmd_delete

 def debug_cmd_delete(self, args):
     bps = self.fr.get_breakpoints()
     if not util.is_int(args) or int(args) - 1 not in list(range(len(bps))):
         log("Usage: delete BREAKPOINTNUM")
     else:
         self.fr.del_breakpoint(int(args) - 1)
         log("Deleted breakpoint %d." % int(args))
开发者ID:revarbat,项目名称:mufsim,代码行数:7,代码来源:__init__.py

示例8: handle_key_tab

 def handle_key_tab(self, event):
     curridx = self.index(INSERT)
     currline, currpos = [int(i) for i in curridx.split('.')]
     line = self.get('insert linestart', 'insert lineend')
     indent = len(line) - len(line.lstrip())
     toadd = 4 - (indent % 4)
     if currpos <= indent:
         self.insert('insert linestart', ' ' * toadd)
     elif not self.get("insert-1c", "insert").lstrip():
         self.insert(INSERT, ' ' * 4)
     else:
         word = self.get("insert-1c wordstart", "insert")
         words = [
             x for x in (
                 list(primitives.keys()) +
                 list(MufCompiler.builtin_defines.keys())
             )
             if x.startswith(word)
         ]
         words.sort()
         pfx = util.common_prefix(words)
         if len(pfx) > len(word):
             self.delete("insert-1c wordstart", "insert")
             self.insert(INSERT, pfx)
             self._syntax_hilite_line(INSERT)
         else:
             if len(words) > 1:
                 log("Completion: %s" % ", ".join(words))
             self.bell()
     return 'break'
开发者ID:revarbat,项目名称:mufsim,代码行数:30,代码来源:mufeditor.py

示例9: next_prop

 def next_prop(self, prop, suppress=False):
     if not prop or prop[-1] == '/':
         prop = self.normalize_prop(prop)
         if prop:
             pfx = prop + '/'
         else:
             pfx = ''
         prev = ''
     else:
         prop = self.normalize_prop(prop)
         if '/' in prop:
             pfx, prev = prop.rsplit('/', 1)
             pfx += '/'
         else:
             pfx = ''
             prev = prop
     plen = len(pfx)
     out = ''
     for prp in self.properties:
         prp = self.normalize_prop(prp)
         if prp.startswith(pfx):
             sub = prp[plen:].split('/', 1)[0]
             if sub > prev:
                 if not out or pfx + sub < out:
                     out = pfx + sub
     if not suppress:
         log("NEXTPROP \"%s\" on #%d = \"%s\"" % (prop, self.dbref, out))
     return out
开发者ID:gitter-badger,项目名称:mufsim,代码行数:28,代码来源:gamedb.py

示例10: execute_code

 def execute_code(self, level=-1):
     maxcycles = {
         self.MODE_PREEMPT: 999999999,
         self.MODE_FOREGROUND: 10000,
         self.MODE_BACKGROUND: 10000,
     }
     level += len(self.call_stack) if level < 0 else 0
     starttime = time.time()
     self.prev_call_level = level + 1
     addr = self.curr_addr()
     inst = self.get_inst(addr)
     self.prevline = (addr.prog, inst.line)
     slice_cycles = 0
     while self.call_stack:
         addr = self.curr_addr()
         inst = self.get_inst(addr)
         if self.trace:
             log(self.get_trace_line(), msgtype='trace')
         try:
             try:
                 self.cycles += 1
                 slice_cycles += 1
                 inst.execute(self)
                 self.pc_advance(1)
                 if slice_cycles >= maxcycles[self.execution_mode]:
                     self.sleep(0.0)
                 self.check_breakpoints()
             except (MufRuntimeError, db.InvalidObjectError) as e:
                 if not self.catch_trigger(e):
                     self.runtime += time.time() - starttime
                     return
                 self.check_breakpoints()
         except MufBreakExecution as e:
             self.runtime += time.time() - starttime
             return
开发者ID:revarbat,项目名称:mufsim,代码行数:35,代码来源:process.py

示例11: process_reads

 def process_reads(self):
     self.poll_network()
     for pid in list(self.reading_processes.values()):
         ofr = self.processes.get(pid)
         if not ofr:
             continue
         while True:
             if ofr.text_entry:
                 cmd = ofr.text_entry.pop(0)
             elif not netifc.user_descrs(ofr.user.value):
                 cmd = self.read_handler()
             else:
                 break
             if cmd is None or cmd == '@Q':
                 log("Aborting program.")
                 del self.reading_processes[ofr.user.value]
                 self.process_complete(ofr.pid)
                 break
             if not cmd and not ofr.read_wants_blanks:
                 warnlog("Blank line ignored.")
                 continue
             ofr.data_push(cmd)
             ofr.pc_advance(1)
             del self.reading_processes[ofr.user.value]
             self.queue_process(ofr)
             break
开发者ID:revarbat,项目名称:mufsim,代码行数:26,代码来源:processlist.py

示例12: run_code

 def run_code(self):
     self.readline_setup()
     userobj = db.get_player_obj("John_Doe")
     progobj = db.get_registered_obj(userobj, "$cmd/test")
     trigobj = db.get_registered_obj(userobj, "$testaction")
     fr = process_list.new_process()
     fr.setup(
         progobj,
         userobj,
         trigobj,
         self.opts.command
     )
     fr.set_trace(self.opts.trace)
     fr.set_text_entry(self.opts.textentry)
     dbg = ConsoleMufDebugger(fr)
     if self.opts.debug:
         dbg.debug_code()
     else:
         st = time.time()
         dbg.resume_execution()
         et = time.time()
         log("Execution completed in %d steps." % fr.cycles)
         if self.opts.timing:
             log("%g secs elapsed.  %g instructions/sec" %
                 (et-st, fr.cycles/(et-st)))
     self.readline_teardown()
开发者ID:revarbat,项目名称:mufsim,代码行数:26,代码来源:__init__.py

示例13: execute_code

 def execute_code(self, level=-1):
     level += len(self.call_stack) if level < 0 else 0
     self.prev_call_level = level + 1
     addr = self.curr_addr()
     inst = self.get_inst(addr)
     self.prevline = (addr.prog, inst.line)
     self.wait_state = self.WAIT_NONE
     while self.call_stack:
         addr = self.curr_addr()
         inst = self.get_inst(addr)
         if self.trace:
             log(self.get_trace_line(), msgtype='trace')
             sys.stdout.flush()
         try:
             self.cycles += 1
             inst.execute(self)
             self.pc_advance(1)
         except MufBreakExecution as e:
             return
         except (MufRuntimeError, db.InvalidObjectError) as e:
             if not self.catch_trigger(e):
                 return
         finally:
             try:
                 self.check_breakpoints()
             except MufBreakExecution as e:
                 return
开发者ID:gitter-badger,项目名称:mufsim,代码行数:27,代码来源:stackframe.py

示例14: execute

 def execute(self, fr):
     con = fr.data_pop(int)
     descr = netifc.descr_from_con(con)
     if descr >= 0:
         who = netifc.descr_dbref(descr)
         netifc.descr_disconnect(descr)
         log("BOOTED DESCRIPTOR %d: %s" % (descr, db.getobj(who)))
开发者ID:revarbat,项目名称:mufsim,代码行数:7,代码来源:connections.py

示例15: execute

 def execute(self, fr):
     fr.check_underflow(2)
     cmd = fr.data_pop(str)
     obj = fr.data_pop_object()
     log("FORCE %s TO DO: %s" % (obj, cmd))
     cmds.force_level_push(fr.user, fr.program)
     cmds.process_command(fr.proclist, -1, obj.dbref, cmd)
     cmds.force_level_pop()
开发者ID:revarbat,项目名称:mufsim,代码行数:8,代码来源:objectdb.py


注:本文中的mufsim.logger.log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。