Add default logging handler to gather_dnf.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Daniel Mach 2016-06-20 08:09:56 -04:00 committed by Lubomír Sedlář
parent 94d16d8c32
commit 26cac77639

View File

@ -142,10 +142,16 @@ class Gather(GatherBase):
super(Gather, self).__init__(dnf_obj)
self.logger = logger
if not self.logger:
# Default logger
# default logger
self.logger = logging.getLogger("gather_dnf")
self.logger.setLevel(logging.DEBUG)
# default logging handler
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)-8s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S"))
handler.setLevel(logging.DEBUG)
self.logger.addHandler(handler)
self.opts = gather_options
self.logger.debug("Gather received gather_options=%s" % gather_options.__dict__)
self._multilib = pungi.multilib_dnf.Multilib(self.dnf._sack, gather_options.multilib_methods, blacklist=self.opts.multilib_blacklist, whitelist=self.opts.multilib_whitelist)