Move the stream handler to be in the named loggers, not the root logger

This prevents double messages to the stream coming from Pungi.
This commit is contained in:
Jesse Keating 2007-08-17 09:14:18 -04:00 committed by Jesse Keating
parent 7aea97468c
commit 6612ec39ba
3 changed files with 14 additions and 6 deletions

View File

@ -48,9 +48,3 @@ class PungiBase():
format='%(name)s.%(levelname)s: %(message)s',
filename=logfile)
# Create the stdout/err streams and only send INFO+ stuff there
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
console = logging.StreamHandler()
console.setFormatter(formatter)
console.setLevel(logging.INFO)
logging.getLogger('').addHandler(console)

View File

@ -53,6 +53,13 @@ class Gather(pypungi.PungiBase):
# Set our own logging name space
self.logger = logging.getLogger('Pungi.Gather')
# Create the stdout/err streams and only send INFO+ stuff there
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
console = logging.StreamHandler()
console.setFormatter(formatter)
console.setLevel(logging.INFO)
self.logger.addHandler(console)
self.pkglist = pkglist
self.config.cachedir = os.path.join(self.workdir, 'yumcache')
self.polist = []

View File

@ -28,6 +28,13 @@ class Pungi(pypungi.PungiBase):
self.logger = logging.getLogger('Pungi.Pungi')
# Create the stdout/err streams and only send INFO+ stuff there
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
console = logging.StreamHandler()
console.setFormatter(formatter)
console.setLevel(logging.INFO)
self.logger.addHandler(console)
self.prodpath = 'Fedora' # Probably should be defined elsewhere
self.destdir = self.config.get('default', 'destdir')
self.archdir = os.path.join(self.destdir,