Rev 125: Add a bit more logging, and a --debug flag to print log messages to stderr. in http://bazaar.launchpad.net/~jameinel/tarmac/logging

John Arbash Meinel john at arbash-meinel.com
Thu Jul 9 17:25:34 BST 2009


At http://bazaar.launchpad.net/~jameinel/tarmac/logging

------------------------------------------------------------
revno: 125
revision-id: john at arbash-meinel.com-20090709162529-y8elnuyglditw7wg
parent: john at arbash-meinel.com-20090709160256-bwqz1a8iv5wqexz2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: logging
timestamp: Thu 2009-07-09 11:25:29 -0500
message:
  Add a bit more logging, and a --debug flag to print log messages to stderr.
-------------- next part --------------
=== modified file 'tarmac/bin.py'
--- a/tarmac/bin.py	2009-06-29 05:35:28 +0000
+++ b/tarmac/bin.py	2009-07-09 16:25:29 +0000
@@ -71,6 +71,10 @@
         logging.basicConfig(filename=self.configuration.log_file,
             level=logging.INFO)
         self.logger = logging.getLogger('tarmac-lander')
+        if self.options.debug:
+            stderr_handler = logging.StreamHandler(sys.stderr)
+            stderr_handler.setLevel(logging.DEBUG)
+            self.logger.addHandler(stderr_handler)
 
         # Write a pid file
         if not test_mode:
@@ -91,6 +95,8 @@
         parser.add_option('--test-command', type='string', default=None,
             metavar='TEST',
             help='The test command to run after merging a branch.')
+        parser.add_option('--debug', default=False, action='store_true',
+            help='Print information to the screen as well as logging.')
         return parser
 
     def _get_reviewers(self, candidate):
@@ -115,6 +121,8 @@
 
         project = launchpad.projects[self.project]
         try:
+            self.logger.info('Downloading development target:\n    %s',
+                             project.development_focus.branch)
             trunk = Branch(project.development_focus.branch, create_tree=True)
         except AttributeError:
             message = (
@@ -125,12 +133,15 @@
             print message
             sys.exit()
 
+        self.logger.debug('Looking for landing candidates')
         candidates = [entry for entry in trunk.landing_candidates
                         if entry.queue_status == u'Approved' and
                         entry.commit_message]
         if not candidates:
             self.logger.info('No branches approved to land.')
             return
+        else:
+            self.logger.debug('Found %s candidates to land', len(candidates))
 
         for candidate in candidates:
 



More information about the bazaar-commits mailing list