Replace sys.std{out,err} statements with logger/print calls (#331)

* Change global default log level to 'INFO'

We're going to increase our usage of logger statements instead of print instructions (where deemed opportune).

* Replace sys.std{out,err} statements with logger/print calls

Fixes #303.
This commit is contained in:
JoeLametta
2018-12-13 20:21:26 +00:00
committed by GitHub
parent 32cd902821
commit c377417108
9 changed files with 139 additions and 193 deletions

View File

@@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with whipper. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
import logging
import sys
@@ -539,16 +540,15 @@ class SyncRunner(TaskRunner, ITaskListener):
self._task.description, 100.0))
else:
# clear with whitespace
sys.stdout.write("%s\r" % (' ' * self._longest, ))
print(("%s\r" % (' ' * self._longest, )), end='')
def _output(self, what, newline=False, ret=True):
sys.stdout.write(what)
sys.stdout.write(' ' * (self._longest - len(what)))
print(what, end='')
print((' ' * (self._longest - len(what))), end='')
if ret:
sys.stdout.write('\r')
print('\r', end='')
if newline:
sys.stdout.write('\n')
sys.stdout.flush()
print()
if len(what) > self._longest:
self._longest = len(what)