diff -Nru python-click-log-0.2.1/click_log/core.py python-click-log-0.3.2/click_log/core.py --- python-click-log-0.2.1/click_log/core.py 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/click_log/core.py 2018-06-06 08:20:22.000000000 +0000 @@ -34,30 +34,23 @@ def format(self, record): if not record.exc_info: level = record.levelname.lower() + msg = record.getMessage() if level in self.colors: prefix = click.style('{}: '.format(level), **self.colors[level]) - - msg = record.msg - if not PY2 and isinstance(msg, bytes): - msg = msg.decode(sys.getfilesystemencoding(), - 'replace') - elif not isinstance(msg, (text_type, bytes)): - msg = str(msg) - record.msg = '\n'.join(prefix + x for x in msg.splitlines()) - + msg = '\n'.join(prefix + x for x in msg.splitlines()) + return msg return logging.Formatter.format(self, record) class ClickHandler(logging.Handler): + _use_stderr = True + def emit(self, record): try: msg = self.format(record) level = record.levelname.lower() - err = level in ('warning', 'error', 'exception', 'critical') - click.echo(msg, err=err) - except (KeyboardInterrupt, SystemExit): - raise + click.echo(msg, err=self._use_stderr) except Exception: self.handleError(record) diff -Nru python-click-log-0.2.1/click_log/__init__.py python-click-log-0.3.2/click_log/__init__.py --- python-click-log-0.2.1/click_log/__init__.py 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/click_log/__init__.py 2018-06-06 08:20:22.000000000 +0000 @@ -3,7 +3,7 @@ import click -__version__ = '0.2.1' +__version__ = '0.3.2' if not hasattr(click, 'get_current_context'): diff -Nru python-click-log-0.2.1/debian/changelog python-click-log-0.3.2/debian/changelog --- python-click-log-0.2.1/debian/changelog 2019-07-26 22:48:12.000000000 +0000 +++ python-click-log-0.3.2/debian/changelog 2022-06-18 04:33:54.000000000 +0000 @@ -1,3 +1,34 @@ +python-click-log (0.3.2-1) unstable; urgency=medium + + * Team Upload. + [ Debian Janitor ] + * Set upstream metadata fields: Bug-Database, Repository, Repository- + Browse. + * Remove constraints unnecessary since stretch: + + Build-Depends: Drop versioned constraint on dh-python. + + [ Ondřej Nový ] + * d/control: Update Maintainer field with new Debian Python Team + contact address. + * d/control: Update Vcs-* fields with new Debian Python Team Salsa + layout. + + [ Fabrice Bauzac-Stehly ] + * New upstream release. + * Upgrade d/watch to version 4. + * Upgrade the Standards-Version to 4.5.1. + * Declare Rules-Requires-Root: no. + * Bump debhelper from old 10 to 13. + * Added an autopkgtest. + + [ Nilesh Patra ] + * Add d/salsa-ci.yml + + [ Debian Janitor ] + * Set upstream metadata fields: Bug-Submit. + + -- Sandro Tosi Sat, 18 Jun 2022 00:33:54 -0400 + python-click-log (0.2.1-2) unstable; urgency=medium * Team upload. diff -Nru python-click-log-0.2.1/debian/control python-click-log-0.3.2/debian/control --- python-click-log-0.2.1/debian/control 2019-07-26 22:48:12.000000000 +0000 +++ python-click-log-0.3.2/debian/control 2022-06-18 04:33:54.000000000 +0000 @@ -1,19 +1,20 @@ Source: python-click-log -Maintainer: Debian Python Modules Team +Maintainer: Debian Python Team Uploaders: Filip Pytloun Section: python Priority: optional -Build-Depends: debhelper-compat (= 10), - dh-python (>= 2.20160609~), +Build-Depends: debhelper-compat (= 13), + dh-python, python3-all, python3-click, python3-pytest, - python3-setuptools, -Standards-Version: 4.1.2 + python3-setuptools +Standards-Version: 4.5.1 Testsuite: autopkgtest-pkg-python Homepage: https://github.com/click-contrib/click-log -Vcs-Browser: https://salsa.debian.org/python-team/modules/python-click-log -Vcs-Git: https://salsa.debian.org/python-team/modules/python-click-log.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-click-log +Vcs-Git: https://salsa.debian.org/python-team/packages/python-click-log.git +Rules-Requires-Root: no Package: python3-click-log Architecture: all diff -Nru python-click-log-0.2.1/debian/salsa-ci.yml python-click-log-0.3.2/debian/salsa-ci.yml --- python-click-log-0.2.1/debian/salsa-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ python-click-log-0.3.2/debian/salsa-ci.yml 2022-06-18 04:33:54.000000000 +0000 @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff -Nru python-click-log-0.2.1/debian/tests/basic python-click-log-0.3.2/debian/tests/basic --- python-click-log-0.2.1/debian/tests/basic 1970-01-01 00:00:00.000000000 +0000 +++ python-click-log-0.3.2/debian/tests/basic 2022-06-18 04:33:54.000000000 +0000 @@ -0,0 +1,36 @@ +#!/bin/bash + +# This test exercises the example described in the README. + +# basic-command is the example program from the README. +cmd=debian/tests/basic-command + +die () { + printf '%s\n' "$*" 1>&2 + exit 1 +} + +chmod +x $cmd || exit 1 +log=$AUTOPKGTEST_TMP/error.log + +$cmd &>$log + +text='error: Failed to divide by zero' +# The output must contain this text. +if ! grep -q "$text" $log; then + echo "Should have output the error, but did not." + echo "Log: --" + cat $log + echo "--" + exit 1 +fi + +# With verbosity critical, the output must not contain the error text. +$cmd --verbosity=critical &>$log +if grep -q "$text" $log; then + echo "Should have NOT output the error." + echo "Log: --" + cat $log + echo "--" + exit 1 +fi diff -Nru python-click-log-0.2.1/debian/tests/basic-command python-click-log-0.3.2/debian/tests/basic-command --- python-click-log-0.2.1/debian/tests/basic-command 1970-01-01 00:00:00.000000000 +0000 +++ python-click-log-0.3.2/debian/tests/basic-command 2022-06-18 04:33:54.000000000 +0000 @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +import logging + +import click +import click_log + +logger = logging.getLogger(__name__) +click_log.basic_config(logger) + +@click.command() +@click_log.simple_verbosity_option(logger) +def cli(): + logger.info("Dividing by zero.") + + try: + 1 / 0 + except: + logger.error("Failed to divide by zero.") + +if __name__ == "__main__": + cli() diff -Nru python-click-log-0.2.1/debian/tests/control python-click-log-0.3.2/debian/tests/control --- python-click-log-0.2.1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ python-click-log-0.3.2/debian/tests/control 2022-06-18 04:33:54.000000000 +0000 @@ -0,0 +1 @@ +Tests: basic diff -Nru python-click-log-0.2.1/debian/upstream/metadata python-click-log-0.3.2/debian/upstream/metadata --- python-click-log-0.2.1/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ python-click-log-0.3.2/debian/upstream/metadata 2022-06-18 04:33:54.000000000 +0000 @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/click-contrib/click-log/issues +Bug-Submit: https://github.com/click-contrib/click-log/issues/new +Repository: https://github.com/click-contrib/click-log.git +Repository-Browse: https://github.com/click-contrib/click-log diff -Nru python-click-log-0.2.1/debian/watch python-click-log-0.3.2/debian/watch --- python-click-log-0.2.1/debian/watch 2019-07-26 22:48:12.000000000 +0000 +++ python-click-log-0.3.2/debian/watch 2022-06-18 04:33:54.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 +version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/python-click-log-$1\.tar\.gz/ \ https://github.com/click-contrib/click-log/tags .*/v?(\d\S*)\.tar\.gz diff -Nru python-click-log-0.2.1/docs/index.rst python-click-log-0.3.2/docs/index.rst --- python-click-log-0.2.1/docs/index.rst 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/docs/index.rst 2018-06-06 08:20:22.000000000 +0000 @@ -86,14 +86,10 @@ The ``error:``-prefix will be red, unless the output is piped to another command. -Under the hood, click-log will get the logger by the given name, and store it -on the click context object. You can then use :py:func:`get_level` and -:py:func:`set_level`. Those functions will look up the logger from the context -object without you having to pass any logger object or name. - The :py:func:`simple_verbosity_option` decorator adds a ``--verbosity`` option that takes a (case-insensitive) value of ``DEBUG``, ``INFO``, ``WARNING``, -``ERROR``, or ``CRITICAL``, and calls :py:func:`set_level` accordingly. +``ERROR``, or ``CRITICAL``, and calls ``setLevel`` on the given logger +accordingly. .. note:: diff -Nru python-click-log-0.2.1/.gitignore python-click-log-0.3.2/.gitignore --- python-click-log-0.2.1/.gitignore 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/.gitignore 2018-06-06 08:20:22.000000000 +0000 @@ -9,3 +9,4 @@ click.egg-info .tox .cache +.pytest_cache diff -Nru python-click-log-0.2.1/tests/test_basic.py python-click-log-0.3.2/tests/test_basic.py --- python-click-log-0.2.1/tests/test_basic.py 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/tests/test_basic.py 2018-06-06 08:20:22.000000000 +0000 @@ -73,7 +73,7 @@ result = runner.invoke(cli, catch_exceptions=False) assert not result.exception - assert result.output == 'error: 42\n' * 4 + assert set(result.output.splitlines()) <= set(('error: 42', 'error: b\'42\'')) def test_early_logging(runner): @@ -93,3 +93,13 @@ result = runner.invoke(cli, ['-v', 'debug'], catch_exceptions=False) assert 'debug: hello' in result.output assert 'debug: catch me {}!'.format(i) in result.output + + +def test_logging_args(runner): + @click.command() + @click_log.simple_verbosity_option(test_logger) + def cli(): + test_logger.debug('hello %s', 'world') + + result = runner.invoke(cli, ['-v', 'debug']) + assert 'debug: hello world' in result.output diff -Nru python-click-log-0.2.1/.travis.yml python-click-log-0.3.2/.travis.yml --- python-click-log-0.2.1/.travis.yml 2017-09-25 18:00:57.000000000 +0000 +++ python-click-log-0.3.2/.travis.yml 2018-06-06 08:20:22.000000000 +0000 @@ -3,8 +3,9 @@ python: - 2.7 - pypy - - 3.3 - 3.4 + - 3.5 + - 3.6 install: pip install tox script: tox