[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] Let logging format messages on demand



Thanks, merged.

On Wed, 01 Nov 2017, Ville Skyttä wrote:
> ---
>  distro_tracker/core/tasks.py                  |  7 +++----
>  distro_tracker/vendor/debian/tracker_tasks.py | 15 +++++++--------
>  2 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/distro_tracker/core/tasks.py b/distro_tracker/core/tasks.py
> index f8f283c..3995c80 100644
> --- a/distro_tracker/core/tasks.py
> +++ b/distro_tracker/core/tasks.py
> @@ -516,11 +516,10 @@ class Job(object):
>                      # Inject additional parameters, if any
>                      if parameters:
>                          task.set_parameters(parameters)
> -                    logger.info("Starting task {task}".format(
> -                        task=task.task_name()))
> +                    logger.info("Starting task %s", task.task_name())
>                      task.execute()
> -                    logger.info("Successfully executed task {task}".format(
> -                        task=task.task_name()))
> +                    logger.info("Successfully executed task %s",
> +                                task.task_name())
>                  except Exception:
>                      logger.exception("Problem processing a task.")
>                  # Update dependent tasks based on events raised.
> diff --git a/distro_tracker/vendor/debian/tracker_tasks.py b/distro_tracker/vendor/debian/tracker_tasks.py
> index 0a7b185..9f044c3 100644
> --- a/distro_tracker/vendor/debian/tracker_tasks.py
> +++ b/distro_tracker/vendor/debian/tracker_tasks.py
> @@ -431,8 +431,8 @@ class UpdatePackageBugStats(BaseTask):
>                  bug_counts = [int(count) for count in bug_counts]
>              except ValueError:
>                  logger.warning(
> -                    'Failed to parse bug information for {pkg}: {cnts}'.format(
> -                        pkg=package_name, cnts=bug_counts), exc_info=1)
> +                    'Failed to parse bug information for %s: %s',
> +                    package_name, bug_counts, exc_info=1)
>                  continue
>  
>              # Match the extracted counts with category names
> @@ -520,8 +520,8 @@ class UpdatePackageBugStats(BaseTask):
>                  bug_counts = [int(count) for count in bug_counts]
>              except ValueError:
>                  logger.exception(
> -                    'Failed to parse bug information for {pkg}: {cnts}'.format(
> -                        pkg=package_name, cnts=bug_counts))
> +                    'Failed to parse bug information for %s: %s',
> +                    package_name, bug_counts)
>                  continue
>  
>              bug_stats[package_name] = [
> @@ -598,9 +598,8 @@ class UpdateLintianStatsTask(BaseTask):
>                  }
>              except ValueError:
>                  logger.exception(
> -                    'Failed to parse lintian information for {pkg}: '
> -                    '{line}'.format(
> -                        pkg=package, line=line))
> +                    'Failed to parse lintian information for %s: %s',
> +                    package, line)
>                  continue
>  
>          return all_stats
> @@ -1507,7 +1506,7 @@ class UpdatePiuPartsTask(BaseTask):
>          for suite in suites:
>              content = self._get_piuparts_content(suite)
>              if content is None:
> -                logger.info("There is no piuparts for suite: {}".format(suite))
> +                logger.info("There is no piuparts for suite: %s", suite)
>                  continue
>  
>              for line in content.splitlines():
> -- 
> 2.14.1
> 

-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/


Reply to: