Skip to content

Commit

Permalink
Enable DEBUG loglevel in verbose mode
Browse files Browse the repository at this point in the history
When verbose mode is enbaled in config log on DEBUG level

Signed-off-by: Martin Basti <mbasti@redhat.com>
  • Loading branch information
MartinBasti committed Oct 11, 2022
1 parent 64c0f56 commit a40054d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions koji_containerbuild/plugins/builder_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,17 @@ def osbs(self):
if not self._osbs:
msg = 'Could not successfully instantiate `osbs`'
raise ContainerError(msg)
self.setup_osbs_logging()
log_level = logging.DEBUG if os_conf.get_verbosity() else logging.INFO
self.setup_osbs_logging(level=log_level)

return self._osbs

def setup_osbs_logging(self):
def setup_osbs_logging(self, level=logging.INFO):
# Setting handler more than once will cause duplicated log lines.
# Log handler will persist in child process.
if not self._log_handler_added:
osbs_logger = logging.getLogger(osbs.__name__)
osbs_logger.setLevel(logging.INFO)
osbs_logger.setLevel(level)
log_file = os.path.join(self.resultdir(), 'osbs-client.log')
handler = logging.FileHandler(filename=log_file)
# process (PID) is useful because a buildContainer task forks main process
Expand Down

0 comments on commit a40054d

Please sign in to comment.