コード例 #1
0
ファイル: control_command.py プロジェクト: svn2github/Xpra
 def run(self, *args):
     if len(args)==1 and args[0]=="status":
         from xpra.log import get_all_loggers
         return "logging is enabled for: %s" % str(list([str(x) for x in get_all_loggers() if x.is_debug_enabled()]))
     if len(args)<2:
         self.raise_error("not enough arguments")
     log_cmd = args[0]
     if log_cmd not in ("enable", "disable"):
         self.raise_error("only 'enable' and 'disable' verbs are supported")
     #support both separate arguments and csv:
     categories = []
     for x in args[1:]:
         categories += [v.strip() for v in x.split(",")]
     from xpra.log import add_debug_category, add_disabled_category, enable_debug_for, disable_debug_for
     if log_cmd=="enable":
         add_debug_category(*categories)
         loggers = enable_debug_for(*categories)
     else:
         assert log_cmd=="disable"
         add_disabled_category(*categories)
         loggers = disable_debug_for(*categories)
     if not loggers:
         log.info("no loggers matching: %s", csv(categories))
     else:
         log.info("%sd debugging for: %s", log_cmd, csv(loggers))
     return "logging %sd for %s" % (log_cmd, csv(loggers))
コード例 #2
0
ファイル: control_command.py プロジェクト: cattaka/Xpra
 def run(self, *args):
     if len(args) == 1 and args[0] == "status":
         from xpra.log import get_all_loggers
         return "logging is enabled for: %s" % str(
             list([
                 str(x) for x in get_all_loggers() if x.is_debug_enabled()
             ]))
     if len(args) < 2:
         self.raise_error("not enough arguments")
     log_cmd = args[0]
     if log_cmd not in ("enable", "disable"):
         self.raise_error("only 'enable' and 'disable' verbs are supported")
     #support both separate arguments and csv:
     categories = []
     for x in args[1:]:
         categories += [v.strip() for v in x.split(",")]
     from xpra.log import add_debug_category, add_disabled_category, enable_debug_for, disable_debug_for
     if log_cmd == "enable":
         add_debug_category(*categories)
         loggers = enable_debug_for(*categories)
     else:
         assert log_cmd == "disable"
         add_disabled_category(*categories)
         loggers = disable_debug_for(*categories)
     if not loggers:
         log.info("no loggers matching: %s", csv(categories))
     else:
         log.info("%sd debugging for: %s", log_cmd, csv(loggers))
     return "logging %sd for %s" % (log_cmd, csv(loggers))
コード例 #3
0
ファイル: ui_client_base.py プロジェクト: rudresh2319/Xpra
 def _process_control(self, packet):
     command = packet[1]
     if command == "show_session_info":
         args = packet[2:]
         log("calling show_session_info%s on server request", args)
         self.show_session_info(*args)
     elif command == "show_bug_report":
         self.show_bug_report()
     elif command in ("enable_%s" % x
                      for x in compression.get_enabled_compressors()):
         compressor = command.split("_")[1]
         log.info("switching to %s on server request", compressor)
         self._protocol.enable_compressor(compressor)
     elif command in ("enable_%s" % x
                      for x in packet_encoding.get_enabled_encoders()):
         pe = command.split("_")[1]
         log.info("switching to %s on server request", pe)
         self._protocol.enable_encoder(pe)
     elif command == "name":
         assert len(args) >= 3
         self.server_session_name = args[2]
         log.info("session name updated from server: %s",
                  self.server_session_name)
         #TODO: reset tray tooltip, session info title, etc..
     elif command == "debug":
         args = packet[2:]
         if len(args) < 2:
             log.warn("not enough arguments for debug control command")
             return
         log_cmd = args[0]
         if log_cmd not in ("enable", "disable"):
             log.warn(
                 "invalid debug control mode: '%s' (must be 'enable' or 'disable')",
                 log_cmd)
             return
         categories = args[1:]
         from xpra.log import add_debug_category, add_disabled_category, enable_debug_for, disable_debug_for
         if log_cmd == "enable":
             add_debug_category(*categories)
             loggers = enable_debug_for(*categories)
         else:
             assert log_cmd == "disable"
             add_disabled_category(*categories)
             loggers = disable_debug_for(*categories)
         log.info("%sd debugging for: %s", log_cmd, loggers)
         return
     else:
         log.warn("received invalid control command from server: %s",
                  command)
コード例 #4
0
ファイル: control_command.py プロジェクト: chewi/xpra
 def run(self, *args):
     if len(args) == 1 and args[0] == "status":
         from xpra.log import get_all_loggers
         return "logging is enabled for: %s" % str(
             list([
                 str(x) for x in get_all_loggers() if x.is_debug_enabled()
             ]))
     log_cmd = args[0]
     if log_cmd == "mark":
         for _ in range(10):
             log.info("*" * 80)
         if len(args) > 1:
             log.info("mark: %s", " ".join(args[1:]))
         else:
             log.info("mark")
         for _ in range(10):
             log.info("*" * 80)
         return "mark inserted into logfile"
     if len(args) < 2:
         self.raise_error("not enough arguments")
     if log_cmd not in ("enable", "disable"):
         self.raise_error("only 'enable' and 'disable' verbs are supported")
     from xpra.log import add_debug_category, add_disabled_category, enable_debug_for, disable_debug_for
     #each argument is a group
     loggers = []
     groups = args[1:]
     for group in groups:
         #and each group is a list of categories
         #preferably separated by "+",
         #but we support "," for backwards compatibility:
         categories = [
             v.strip() for v in group.replace("+", ",").split(",")
         ]
         if log_cmd == "enable":
             add_debug_category(*categories)
             loggers += enable_debug_for(*categories)
         else:
             assert log_cmd == "disable"
             add_disabled_category(*categories)
             loggers += disable_debug_for(*categories)
     if not loggers:
         log.info("%s debugging, no new loggers matching: %s", log_cmd,
                  csv(groups))
     else:
         log.info("%sd debugging for:", log_cmd)
         for l in loggers:
             log.info(" - %s", l)
     return "logging %sd for %s" % (log_cmd, csv(loggers)
                                    or "<no match found")
コード例 #5
0
ファイル: dbus_server.py プロジェクト: svn2github/Xpra
 def DisableDebug(self, category):
     self.log(".DisableDebug(%s)", category)
     c = ns(category)
     remove_debug_category(c)
     disable_debug_for(c)
コード例 #6
0
ファイル: dbus_server.py プロジェクト: TianyouLi/Xpra
 def DisableDebug(self, category):
     self.log(".DisableDebug(%s)", category)
     c = ns(category)
     remove_debug_category(c)
     disable_debug_for(c)
コード例 #7
0
ファイル: dbus_server.py プロジェクト: ljmljz/xpra
 def DisableDebug(self, category):
     c = ns(category)
     remove_debug_category(c)
     disable_debug_for(c)
コード例 #8
0
 def _process_control(self, packet):
     command = bytestostr(packet[1])
     if command == "show_session_info":
         args = packet[2:]
         log("calling %s%s on server request", self.show_session_info, args)
         self.show_session_info(*args)
     elif command == "show_bug_report":
         self.show_bug_report()
     elif command in ("enable_%s" % x
                      for x in compression.get_enabled_compressors()):
         compressor = command.split("_")[1]
         log.info("switching to %s on server request", compressor)
         self._protocol.enable_compressor(compressor)
     elif command in ("enable_%s" % x
                      for x in packet_encoding.get_enabled_encoders()):
         pe = command.split("_")[1]
         log.info("switching to %s on server request", pe)
         self._protocol.enable_encoder(pe)
     elif command == "name":
         assert len(args) >= 3
         self.server_session_name = args[2]
         log.info("session name updated from server: %s",
                  self.server_session_name)
         #TODO: reset tray tooltip, session info title, etc..
     elif command == "debug":
         args = packet[2:]
         if not args:
             log.warn("not enough arguments for debug control command")
             return
         from xpra.log import (
             add_debug_category,
             add_disabled_category,
             enable_debug_for,
             disable_debug_for,
             get_all_loggers,
         )
         log_cmd = bytestostr(args[0])
         if log_cmd == "status":
             dloggers = [
                 x for x in get_all_loggers() if x.is_debug_enabled()
             ]
             if dloggers:
                 log.info("logging is enabled for:")
                 for l in dloggers:
                     log.info(" - %s", l)
             else:
                 log.info("logging is not enabled for any loggers")
             return
         log_cmd = bytestostr(args[0])
         if log_cmd not in ("enable", "disable"):
             log.warn(
                 "invalid debug control mode: '%s' (must be 'enable' or 'disable')",
                 log_cmd)
             return
         if len(args) < 2:
             log.warn(
                 "not enough arguments for '%s' debug control command" %
                 log_cmd)
             return
         loggers = []
         #each argument is a group
         groups = [bytestostr(x) for x in args[1:]]
         for group in groups:
             #and each group is a list of categories
             #preferably separated by "+",
             #but we support "," for backwards compatibility:
             categories = [
                 v.strip() for v in group.replace("+", ",").split(",")
             ]
             if log_cmd == "enable":
                 add_debug_category(*categories)
                 loggers += enable_debug_for(*categories)
             else:
                 assert log_cmd == "disable"
                 add_disabled_category(*categories)
                 loggers += disable_debug_for(*categories)
         if not loggers:
             log.info("%s debugging, no new loggers matching: %s", log_cmd,
                      csv(groups))
         else:
             log.info("%sd debugging for:", log_cmd)
             for l in loggers:
                 log.info(" - %s", l)
     else:
         log.warn("received invalid control command from server: %s",
                  command)
コード例 #9
0
ファイル: dbus_server.py プロジェクト: rudresh2319/Xpra
 def DisableDebug(self, category):
     c = ns(category)
     remove_debug_category(c)
     disable_debug_for(c)