From 9ab4e55bc56e4f56b56927ede11c3065cea8fce5 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 27 Mar 2018 21:57:02 +0200
Subject: [PATCH] chore: reduce logger.debug volume

---
 lib/config/decrypt.js                       |  3 +--
 lib/manager/index.js                        |  5 ++---
 lib/manager/npm/extract.js                  | 22 +++++++++++++--------
 lib/manager/npm/package.js                  |  2 +-
 lib/platform/github/index.js                |  1 -
 lib/workers/package/versions.js             |  4 +---
 lib/workers/pr/release-notes.js             |  2 +-
 lib/workers/repository/updates/branchify.js |  1 -
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/lib/config/decrypt.js b/lib/config/decrypt.js
index 80d7836940..6c2404c8ba 100644
--- a/lib/config/decrypt.js
+++ b/lib/config/decrypt.js
@@ -5,8 +5,7 @@ module.exports = {
 };
 
 function decryptConfig(config, privateKey) {
-  logger.debug('decryptConfig()');
-  logger.trace({ config });
+  logger.trace({ config }, 'decryptConfig()');
   const decryptedConfig = { ...config };
   for (const [key, val] of Object.entries(config)) {
     if (key === 'encrypted' && isObject(val)) {
diff --git a/lib/manager/index.js b/lib/manager/index.js
index 31fa296b52..ec6e6b3db0 100644
--- a/lib/manager/index.js
+++ b/lib/manager/index.js
@@ -40,7 +40,7 @@ async function detectPackageFiles(config) {
       files = await managers[manager].detectPackageFiles(config, fileList);
     } else {
       logger.debug(
-        { filePattern: managers[manager].filePattern },
+        { filePattern: managers[manager].filePattern.toString() },
         'Using file pattern'
       );
       const allfiles = fileList.filter(file =>
@@ -74,8 +74,7 @@ function extractDependencies(packageContent, config) {
 }
 
 function getPackageUpdates(config) {
-  logger.debug({ dependency: config.depName }, 'manager.getPackageUpdates()');
-  logger.trace({ config });
+  logger.trace({ config }, 'manager.getPackageUpdates()');
   const { manager } = config;
   if (!managerList.includes(manager)) {
     throw new Error('Unsupported package manager');
diff --git a/lib/manager/npm/extract.js b/lib/manager/npm/extract.js
index 1f01c9d4e7..25299a2203 100644
--- a/lib/manager/npm/extract.js
+++ b/lib/manager/npm/extract.js
@@ -22,25 +22,31 @@ function extractDependencies(packageJson, config) {
         logger.debug('Looking for locked version');
         const lockFile = packageLockParsed || npmShrinkwrapParsed;
         if (lockFile) {
-          logger.debug({ currentVersion }, 'Found parsed npm lock');
           if (lockFile.dependencies[depName]) {
-            logger.debug('Found match');
             lockedVersion = lockFile.dependencies[depName].version;
+            if (lockedVersion !== currentVersion) {
+              logger.debug(
+                { currentVersion, lockedVersion },
+                'Found locked version'
+              );
+            }
           } else {
-            logger.debug('No match');
+            logger.debug({ currentVersion }, 'Found no locked version');
           }
         } else if (yarnLockParsed && yarnLockParsed.object) {
-          logger.debug({ currentVersion }, 'Found parsed yarn.lock');
           const key = `${depName}@${currentVersion}`;
           const lockEntry = yarnLockParsed.object[key];
           if (lockEntry) {
-            logger.debug('Found match');
             lockedVersion = lockEntry.version;
+            if (lockedVersion !== currentVersion) {
+              logger.debug(
+                { currentVersion, lockedVersion },
+                'Found locked version'
+              );
+            }
           } else {
-            logger.debug('No match');
+            logger.debug({ currentVersion }, 'Found no locked version');
           }
-        } else {
-          logger.debug('No lock file found');
         }
       } catch (err) {
         logger.debug({ currentVersion }, 'Could not find locked version');
diff --git a/lib/manager/npm/package.js b/lib/manager/npm/package.js
index 8201e950f8..571a6403c3 100644
--- a/lib/manager/npm/package.js
+++ b/lib/manager/npm/package.js
@@ -7,7 +7,7 @@ module.exports = {
 };
 
 async function getPackageUpdates(config) {
-  logger.debug({ dependency: config.depName }, `npm.getPackageUpdates()`);
+  logger.trace({ config }, `npm.getPackageUpdates()`);
   if (config.depType === 'engines') {
     if (config.depName !== 'node') {
       logger.debug('Skipping non-node engine');
diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index 5f0bd29a17..99e60ab0c9 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -352,7 +352,6 @@ async function getFileList(branchName = config.baseBranch) {
 
 // Returns true if branch exists, otherwise false
 async function branchExists(branchName) {
-  logger.debug(`branchExists(${branchName})`);
   if (!config.branchList) {
     logger.debug('Retrieving branchList');
     config.branchList = (await get(
diff --git a/lib/workers/package/versions.js b/lib/workers/package/versions.js
index d3de434e3b..601c43a5f8 100644
--- a/lib/workers/package/versions.js
+++ b/lib/workers/package/versions.js
@@ -182,7 +182,6 @@ function determineUpgrades(npmDep, config) {
           changeLogFromVersion,
           changeLogToVersion,
         };
-        logger.debug({ allUpgrades });
         if (type === 'major') {
           allUpgrades[upgradeKey].isMajor = true;
         } else if (type === 'minor') {
@@ -202,7 +201,6 @@ function determineUpgrades(npmDep, config) {
 
   // Return now if array is empty, or we can keep pinned version upgrades
   if (upgrades.length === 0 || config.pinVersions || !isRange(currentVersion)) {
-    logger.debug({ upgrades });
     return rangeOperator
       ? upgrades.map(upgrade => ({
           ...upgrade,
@@ -212,7 +210,7 @@ function determineUpgrades(npmDep, config) {
       : upgrades;
   }
 
-  logger.debug({ dependency }, 'User wanrs ranges - filtering out pins');
+  logger.debug({ dependency }, 'User wants ranges - filtering out pins');
   upgrades = upgrades.filter(upgrade => upgrade.type !== 'pin');
 
   // Return empty if all results were pins
diff --git a/lib/workers/pr/release-notes.js b/lib/workers/pr/release-notes.js
index e5f426a9fe..9666f1c90b 100644
--- a/lib/workers/pr/release-notes.js
+++ b/lib/workers/pr/release-notes.js
@@ -67,7 +67,7 @@ async function getReleaseNotes(repository, version) {
       }
     }
   });
-  logger.debug({ releaseNotes });
+  logger.trace({ releaseNotes });
   return releaseNotes;
 }
 
diff --git a/lib/workers/repository/updates/branchify.js b/lib/workers/repository/updates/branchify.js
index 36acdbbe69..91e5dc88ff 100644
--- a/lib/workers/repository/updates/branchify.js
+++ b/lib/workers/repository/updates/branchify.js
@@ -33,7 +33,6 @@ function branchifyUpgrades(config) {
           upgrade
         );
       } else {
-        logger.debug('Using regular branchName template');
         upgrade.branchName = handlebars.compile(upgrade.branchName)(upgrade);
       }
       // Compile extra times in case of nested handlebars templates
-- 
GitLab