Add commandline arguments to enable verbose mode
Create a logger hierarchy, that way we only need to set the root logger to DEBUG and the rest goes along with it.
This commit is contained in:
parent
8a81b1c245
commit
f9756a71ce
15
tuhi.py
15
tuhi.py
|
@ -11,6 +11,7 @@
|
|||
# GNU General Public License for more details.
|
||||
#
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
|
@ -20,7 +21,8 @@ from tuhi.dbusserver import TuhiDBusServer
|
|||
from tuhi.ble import BlueZDeviceManager
|
||||
from tuhi.wacom import WacomDevice, Stroke
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logging.basicConfig(format='%(levelname)s: %(name)s: %(message)s',
|
||||
level=logging.INFO)
|
||||
logger = logging.getLogger('tuhi')
|
||||
|
||||
WACOM_COMPANY_ID = 0x4755
|
||||
|
@ -158,6 +160,17 @@ class Tuhi(GObject.Object):
|
|||
|
||||
|
||||
def main(args):
|
||||
desc = "Daemon to extract the pen stroke data from Wacom SmartPad devices"
|
||||
parser = argparse.ArgumentParser(description=desc)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
help='Show some debugging informations',
|
||||
action='store_true',
|
||||
default=False)
|
||||
|
||||
ns = parser.parse_args(args[1:])
|
||||
if ns.verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
Tuhi()
|
||||
try:
|
||||
GObject.MainLoop().run()
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
import logging
|
||||
from gi.repository import GObject, Gio
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('ble')
|
||||
logger = logging.getLogger('tuhi.ble')
|
||||
|
||||
ORG_BLUEZ_GATTCHARACTERISTIC1 = 'org.bluez.GattCharacteristic1'
|
||||
ORG_BLUEZ_GATTSERVICE1 = 'org.bluez.GattService1'
|
||||
|
|
|
@ -15,8 +15,7 @@ import logging
|
|||
|
||||
from gi.repository import GObject, Gio, GLib
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('dbus')
|
||||
logger = logging.getLogger('tuhi.dbus')
|
||||
|
||||
INTROSPECTION_XML = """
|
||||
<node>
|
||||
|
|
|
@ -18,8 +18,7 @@ import threading
|
|||
import time
|
||||
from gi.repository import GObject
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger('wacom')
|
||||
logger = logging.getLogger('tuhi.wacom')
|
||||
|
||||
WACOM_COMPANY_ID = 0x4755
|
||||
NORDIC_UART_SERVICE_UUID = '6e400001-b5a3-f393-e0a9-e50e24dcca9e'
|
||||
|
|
Loading…
Reference in New Issue