#2369 common, keygen: logging shouldn't affect stdout
Merged 2 years ago by praiskup. Opened 2 years ago by praiskup.
Unknown source fix-signing  into  main

file modified
+4 -5
@@ -2,7 +2,6 @@

  Common Copr code for logging

  """

  

- import sys

  import logging

  

  
@@ -21,10 +20,10 @@

      # Drop the default handler, we will create it ourselves

      log.handlers = []

  

-     # Print to stdout

-     stdout_log = logging.StreamHandler(sys.stdout)

-     stdout_log.setFormatter(logging.Formatter("%(message)s"))

-     log.addHandler(stdout_log)

+     # Print also to stderr

+     stream = logging.StreamHandler()

When we do log.info("foo") will it go to stderr then?

+     stream.setFormatter(logging.Formatter("%(message)s"))

+     log.addHandler(stream)

  

      # Add file logging

      file_log = logging.FileHandler(path)

@@ -16,7 +16,7 @@

  %endif

  

  Name:       python-copr-common

- Version:    0.16.2.dev

+ Version:    0.16.3.dev

  Release:    1%{?dist}

  Summary:    Python code used by Copr

  

file modified
+1 -1
@@ -1,5 +1,5 @@

  %global with_test 1

- %global copr_common_version 0.15.1.dev

+ %global copr_common_version 0.16.3.dev

  

  Name:       copr-keygen

  Version:    1.85

Backend sign command failed with:
'/bin/sign -h dummy-pkg-20221113_1352-1.src.rpm' failed with: packet is not a signature

rebased onto cc61611

2 years ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

rebased onto cc61611

2 years ago

rebased onto b3d01b0

2 years ago

Build succeeded.

rebased onto 1d57537

2 years ago

Build succeeded.

When we do log.info("foo") will it go to stderr then?

When we do log.info("foo") will it go to stderr then?

Yes, that's by default:
https://docs.python.org/3/library/logging.handlers.html#logging.StreamHandler

Commit 3ee0723 fixes this pull-request

Pull-Request has been merged by praiskup

2 years ago