[gnome-tweak-tool] Improve debug/logging
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Improve debug/logging
- Date: Wed, 27 Apr 2011 12:07:32 +0000 (UTC)
commit 82da273bc4928f89465f32dfff419e84657d7456
Author: John Stowers <john stowers gmail com>
Date: Wed Apr 27 20:30:41 2011 +1200
Improve debug/logging
gnome-tweak-tool | 2 +-
gtweak/gconf.py | 3 ++-
gtweak/gsettings.py | 6 +++---
gtweak/utils.py | 7 ++++---
4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gnome-tweak-tool b/gnome-tweak-tool
index 4902a66..a1f08b0 100755
--- a/gnome-tweak-tool
+++ b/gnome-tweak-tool
@@ -79,7 +79,7 @@ if __name__ == '__main__':
gtweak.PKG_DATA_DIR = PKG_DATA_DIR
gtweak.ENABLE_TEST = options.test
- logging.basicConfig()
+ logging.basicConfig(format="%(levelname)-8s: %(message)s", level=logging.INFO)
MainWindow()
diff --git a/gtweak/gconf.py b/gtweak/gconf.py
index f74bec2..3b60d07 100644
--- a/gtweak/gconf.py
+++ b/gtweak/gconf.py
@@ -16,6 +16,7 @@
# along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>.
import subprocess
+import logging
from gi.repository import GConf
@@ -40,7 +41,7 @@ class GConfSetting:
else:
self._cmd_cache[command] = "ERROR: %s" % stderr.strip()
- print "Caching gconf: %s (%s)" % (self, command)
+ logging.info("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 bcdf144..6f20ec4 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>.
+import logging
import os.path
import xml.dom.minidom
@@ -44,8 +45,7 @@ class _GSettingsSchema:
"summary" : key.getElementsByTagName("summary")[0].childNodes[0].data,
"description" : key.getElementsByTagName("description")[0].childNodes[0].data}
except:
- import traceback
- traceback.print_exc()
+ logging.critical("Error parsing schema", exc_info=True)
def __repr__(self):
return "<gtweak.gsettings._GSettingsSchema: %s>" % self._schema_name
@@ -57,7 +57,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)
- print "Caching gsettings: %s" % _SCHEMA_CACHE[schema_name]
+ logging.info("Caching gsettings: %s" % _SCHEMA_CACHE[schema_name])
self._schema = _SCHEMA_CACHE[schema_name]
diff --git a/gtweak/utils.py b/gtweak/utils.py
index d3d86ff..99a33f1 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -34,6 +34,7 @@ def walk_directories(dirs, filter_func):
class AutostartManager:
def __init__(self, DATA_DIR, desktop_filename, exec_cmd="", extra_exec_args=""):
+ self._desktop_filename = desktop_filename
self._desktop_file = os.path.join(DATA_DIR, "applications", desktop_filename)
self._autostart_file = os.path.join(
GLib.get_user_config_dir(), "autostart", desktop_filename)
@@ -50,10 +51,10 @@ class AutostartManager:
return False
def update_start_at_login(self, update):
- logging.debug("updating autostart desktop file: %s" % update)
+ logging.debug("Updating autostart %s -> %s" % (self._desktop_filename, update))
if os.path.exists(self._autostart_file):
- logging.info("Removing autostart desktop file")
+ logging.info("Removing autostart %s" % self._autostart_file)
os.remove(self._autostart_file)
if update:
@@ -61,7 +62,7 @@ class AutostartManager:
logging.critical("Could not find desktop file: %s" % self._desktop_file)
return
- logging.info("Adding autostart desktop file")
+ logging.info("Adding autostart %s" % self._autostart_file)
#copy the original file to the new file, but add the extra exec args
old = open(self._desktop_file, "r")
new = open(self._autostart_file, "w")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]