]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake: Move the logger initialization from cooker to utils
authorJeff Dike <jdike@linux.intel.com>
Tue, 29 Jun 2010 12:32:04 +0000 (13:32 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 29 Jun 2010 12:32:04 +0000 (13:32 +0100)
In order to move the environment cleaning, which wants to log a
message, before cooker creation, the logging facility initialization
needs to happen earlier.  So, it is now in init_logger in utils.py and
called from bitbake before the creation of the data object.

It also seems more correct to initialize a global facility like this
from a more global context than the creation of an object, of which
there could theoretically be many.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/bin/bitbake
bitbake/lib/bb/cooker.py
bitbake/lib/bb/utils.py

index 1a45ec4f791f07e581f6670e31b0fbac1c36ec29..0f4ff88171bbbb12a7c4683a0e63b93f651ce461 100755 (executable)
@@ -152,6 +152,9 @@ Default BBFILES are the .bb files in the current directory.""" )
     # server is daemonized this logfile will be truncated.
     cooker_logfile = os.path.join (os.getcwd(), "cooker.log")
 
+    bb.utils.init_logger(bb.msg, configuration.verbose, configuration.debug,
+                         configuration.debug_domains)
+
     cooker = bb.cooker.BBCooker(configuration, server)
 
     # Clear away any spurious environment variables. But don't wipe the
index 3881df484af37213671853415b7d7ed8709d0582..2406dfe95bc44ad69dafe218464860d187485357 100644 (file)
@@ -72,17 +72,6 @@ class BBCooker:
 
         self.configuration = configuration
 
-        if self.configuration.verbose:
-            bb.msg.set_verbose(True)
-
-        if self.configuration.debug:
-            bb.msg.set_debug_level(self.configuration.debug)
-        else:
-            bb.msg.set_debug_level(0)
-
-        if self.configuration.debug_domains:
-            bb.msg.set_debug_domains(self.configuration.debug_domains)
-
         self.configuration.data = bb.data.init()
 
         bb.data.inheritFromOS(self.configuration.data)
index ad0aa68b27d5b78036743db6eff92956d21c7808..40326f98d2613bf917a68b16dbb0fdd55e89aa62 100644 (file)
@@ -614,3 +614,19 @@ def which(path, item, direction = 0):
             return next
 
     return ""
+
+def init_logger(logger, verbose, debug, debug_domains):
+    """
+    Set verbosity and debug levels in the logger
+    """
+
+    if verbose:
+        logger.set_verbose(True)
+
+    if debug:
+        logger.set_debug_level(debug)
+    else:
+        logger.set_debug_level(0)
+
+    if debug_domains:
+        logger.set_debug_domains(debug_domains)