Commit 82da273b authored by John Stowers's avatar John Stowers

Improve debug/logging

parent 819dddcf
......@@ -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()
......@@ -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):
......
......@@ -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]
......
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment