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:
parent
7aea97468c
commit
6612ec39ba
@ -48,9 +48,3 @@ class PungiBase():
|
|||||||
format='%(name)s.%(levelname)s: %(message)s',
|
format='%(name)s.%(levelname)s: %(message)s',
|
||||||
filename=logfile)
|
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)
|
|
||||||
|
@ -53,6 +53,13 @@ class Gather(pypungi.PungiBase):
|
|||||||
# Set our own logging name space
|
# Set our own logging name space
|
||||||
self.logger = logging.getLogger('Pungi.Gather')
|
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.pkglist = pkglist
|
||||||
self.config.cachedir = os.path.join(self.workdir, 'yumcache')
|
self.config.cachedir = os.path.join(self.workdir, 'yumcache')
|
||||||
self.polist = []
|
self.polist = []
|
||||||
|
@ -28,6 +28,13 @@ class Pungi(pypungi.PungiBase):
|
|||||||
|
|
||||||
self.logger = logging.getLogger('Pungi.Pungi')
|
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.prodpath = 'Fedora' # Probably should be defined elsewhere
|
||||||
self.destdir = self.config.get('default', 'destdir')
|
self.destdir = self.config.get('default', 'destdir')
|
||||||
self.archdir = os.path.join(self.destdir,
|
self.archdir = os.path.join(self.destdir,
|
||||||
|
Loading…
Reference in New Issue
Block a user