backup.py

changeset 34
9fce700d42de
parent 32
06fc14211ba9
child 38
085a635f23f5
--- a/backup.py	Sun Jan 21 14:56:56 2018 +0000
+++ b/backup.py	Sun Jan 21 16:21:53 2018 +0000
@@ -6,11 +6,12 @@
 import logging
 import time
 import keyring
+import borgend
 from instance import BorgInstance
 from queue import Queue
 from threading import Thread, Lock, Timer
 
-logger=logging.getLogger(__name__)
+logger=borgend.logger.getChild(__name__)
 
 loglevel_translation={
     'CRITICAL': logging.CRITICAL,
@@ -291,7 +292,7 @@
                 else:
                     raise NotImplementedError("Invalid operation '%s'" % op['operation'])
             except Exception as err:
-                logging.debug('Rescheduling after failure')
+                logger.debug('Rescheduling after failure')
                 self.lastrun_when=time.monotonic()
                 self.lastrun_success=False
                 self.__schedule_unlocked()
@@ -348,7 +349,7 @@
             self.timer=None
 
             if self.__is_running_unlocked():
-                logging.info('Aborted queue operation, as an operation is already running')
+                logger.info('Aborted queue operation, as an operation is already running')
             else:
                 # TODO: Queue on 'repository' and online status for SSH, etc.
 
@@ -392,8 +393,8 @@
             if op:
                 now=time.monotonic()
                 delay=max(0, op['when_monotonic']-now)
-                logging.info("Scheduling '%s' (detail: %s) of '%s' in %d seconds" %
-                             (op['operation'], op['detail'], self.name, delay))
+                logger.info("Scheduling '%s' (detail: %s) of '%s' in %d seconds" %
+                            (op['operation'], op['detail'], self.name, delay))
                 tmr=Timer(delay, self.__queue_timed_operation)
                 self.scheduled_operation=op
                 self.timer=tmr

mercurial