diff --git a/qubesmgmt/app.py b/qubesmgmt/app.py index bee14cd..df34f36 100644 --- a/qubesmgmt/app.py +++ b/qubesmgmt/app.py @@ -26,6 +26,8 @@ Main Qubes() class and related classes. import socket import subprocess +import logging + import qubesmgmt.base import qubesmgmt.exc import qubesmgmt.label @@ -114,6 +116,8 @@ class QubesBase(qubesmgmt.base.PropertyHolder): pools = None #: type of qubesd connection: either 'socket' or 'qrexec' qubesd_connection_type = None + #: logger + log = None def __init__(self): super(QubesBase, self).__init__(self, 'mgmt.property.', 'dom0') @@ -124,6 +128,7 @@ class QubesBase(qubesmgmt.base.PropertyHolder): self, 'mgmt.pool.List', qubesmgmt.storage.Pool) #: cache for available storage pool drivers and options to create them self._pool_drivers = None + self.log = logging.getLogger('app') def _refresh_pool_drivers(self): ''' diff --git a/qubesmgmt/log.py b/qubesmgmt/log.py index df8fc1d..01bce9c 100644 --- a/qubesmgmt/log.py +++ b/qubesmgmt/log.py @@ -29,7 +29,7 @@ import sys import dbus -FORMAT_CONSOLE = '%(message)s' +FORMAT_CONSOLE = '%(name)s: %(message)s' FORMAT_LOG = '%(asctime)s %(message)s' FORMAT_DEBUG = '%(asctime)s ' \ '[%(processName)s %(module)s.%(funcName)s:%(lineno)d] %(name)s: %(message)s' diff --git a/qubesmgmt/vm/__init__.py b/qubesmgmt/vm/__init__.py index 5ad97ba..c97718c 100644 --- a/qubesmgmt/vm/__init__.py +++ b/qubesmgmt/vm/__init__.py @@ -20,15 +20,20 @@ '''Qubes VM objects.''' +import logging import qubesmgmt.base import qubesmgmt.storage class QubesVM(qubesmgmt.base.PropertyHolder): '''Qubes domain.''' + + log = None + def __init__(self, app, name): super(QubesVM, self).__init__(app, 'mgmt.vm.property.', name) self._volumes = None + self.log = logging.getLogger(name) @property def name(self):