[gnome-tweak-tool] Add --debug command line argument



commit f0a5d3b9ea6d011f9e6667d7e63faebe361e8c20
Author: John Stowers <john stowers gmail com>
Date:   Thu Jul 28 22:32:20 2011 +1200

    Add --debug command line argument

 gnome-tweak-tool             |    8 +++++++-
 gtweak/gconf.py              |    2 +-
 gtweak/gsettings.py          |    2 +-
 gtweak/tweaks/tweak_shell.py |    4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gnome-tweak-tool b/gnome-tweak-tool
index 2ffd910..80f99f3 100755
--- a/gnome-tweak-tool
+++ b/gnome-tweak-tool
@@ -59,6 +59,8 @@ if __name__ == '__main__':
                   help="Installation prefix (for gsettings schema, themes, etc)", metavar="[/, /usr]")
     parser.add_option("-v", "--verbose", action="store_true",
                   help="Print the names of settings modified")
+    parser.add_option("-d", "--debug", action="store_true",
+                  help="Enable debug output")
     options, args = parser.parse_args()
 
     try:
@@ -86,7 +88,11 @@ if __name__ == '__main__':
     gtweak.APP_NAME = "gnome-tweak-tool"
     gtweak.VERBOSE = options.verbose
 
-    logging.basicConfig(format="%(levelname)-8s: %(message)s", level=logging.INFO)
+    if options.debug:
+        level=logging.DEBUG
+    else:
+        level=logging.INFO
+    logging.basicConfig(format="%(levelname)-8s: %(message)s", level=level)
 
     locale.setlocale(locale.LC_ALL, None)
     gettext.bindtextdomain(gtweak.APP_NAME, LOCALE_DIR)
diff --git a/gtweak/gconf.py b/gtweak/gconf.py
index 5a05ebf..16f0a92 100644
--- a/gtweak/gconf.py
+++ b/gtweak/gconf.py
@@ -43,7 +43,7 @@ class GConfSetting:
             else:
                 self._cmd_cache[command] = "ERROR: %s" % stderr.strip()
 
-        logging.info("Caching gconf: %s (%s)" % (self, command))
+        logging.debug("Caching gconf: %s (%s)" % (self, command))
         return self._cmd_cache[command]
 
     def schema_get_summary(self):
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index 0c41d44..e59a101 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -64,7 +64,7 @@ class GSettingsSetting(Gio.Settings):
         Gio.Settings.__init__(self, schema_name)
         if schema_name not in _SCHEMA_CACHE:
             _SCHEMA_CACHE[schema_name] = _GSettingsSchema(schema_name, **options)
-            logging.info("Caching gsettings: %s" % _SCHEMA_CACHE[schema_name])
+            logging.debug("Caching gsettings: %s" % _SCHEMA_CACHE[schema_name])
 
         self._schema = _SCHEMA_CACHE[schema_name]
 
diff --git a/gtweak/tweaks/tweak_shell.py b/gtweak/tweaks/tweak_shell.py
index 8bccec0..7fcdb97 100644
--- a/gtweak/tweaks/tweak_shell.py
+++ b/gtweak/tweaks/tweak_shell.py
@@ -68,7 +68,7 @@ class ShellThemeTweak(Tweak):
                     #assume the usertheme version is that version of the shell which
                     #it most supports (this is a poor assumption)
                     self._usertheme_extension_version = max(extensions[ShellThemeTweak.THEME_EXT_NAME]["shell-version"])
-                    logging.info("Shell user-theme extension v%s", self._usertheme_extension_version)
+                    logging.debug("Shell user-theme extension v%s", self._usertheme_extension_version)
 
                     error = None
                 except:
@@ -139,7 +139,7 @@ class ShellThemeTweak(Tweak):
                     raise Exception("Could not find gnome-shell.css")
 
                 if not theme_name:
-                    logging.info("Old style theme detected (theme.json)")
+                    logging.info("Old style theme detected (missing theme.json)")
                     #old style themes name was taken from the zip name
                     if fragment[0] == "theme" and len(fragment) == 1:
                         theme_name = os.path.basename(f)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]