mirror of https://github.com/tuhiproject/tuhi.git
gui: unify the loggers across the GUI
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>pull/168/head
parent
6dc67f13c8
commit
c8759eb400
|
@ -12,6 +12,8 @@
|
|||
#
|
||||
|
||||
from gi.repository import Gio, GLib, Gtk
|
||||
import logging
|
||||
|
||||
from .window import MainWindow
|
||||
from .config import Config
|
||||
|
||||
|
@ -19,6 +21,11 @@ import gi
|
|||
gi.require_version("Gio", "2.0")
|
||||
gi.require_version("Gtk", "3.0")
|
||||
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(name)s: %(message)s',
|
||||
level=logging.INFO,
|
||||
datefmt='%H:%M:%S')
|
||||
logger = logging.getLogger('tuhi.gui')
|
||||
|
||||
|
||||
class Application(Gtk.Application):
|
||||
def __init__(self):
|
||||
|
@ -30,6 +37,10 @@ class Application(Gtk.Application):
|
|||
GLib.OptionArg.STRING,
|
||||
'path to configuration directory',
|
||||
'/path/to/config-dir')
|
||||
self.add_main_option('verbose', 0,
|
||||
GLib.OptionFlags.NONE,
|
||||
GLib.OptionArg.NONE,
|
||||
'enable verbose output')
|
||||
self._tuhi = None
|
||||
|
||||
def do_startup(self):
|
||||
|
@ -50,6 +61,9 @@ class Application(Gtk.Application):
|
|||
except KeyError:
|
||||
pass
|
||||
|
||||
if 'verbose' in options:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
self.activate()
|
||||
return 0
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import logging
|
|||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('tuhi.gui.drawingperspective')
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import logging
|
|||
import re
|
||||
import xdg.BaseDirectory
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('tuhi.gui.dbus')
|
||||
|
||||
CONFIG_PATH = os.path.join(xdg.BaseDirectory.xdg_data_home, 'tuhi-kete')
|
||||
|
|
|
@ -22,7 +22,6 @@ import logging
|
|||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('tuhi.gui.window')
|
||||
|
||||
MENU_XML = """
|
||||
|
|
Loading…
Reference in New Issue