diff --git a/lib/api/gitlab.js b/lib/api/gitlab.js index 6752562ff155d7a9f5dba07c9915e90e94b8ce27..adb57dd66bbaa8298a718fd474a66bad0fd1b2f7 100644 --- a/lib/api/gitlab.js +++ b/lib/api/gitlab.js @@ -89,7 +89,7 @@ async function initRepo(repoName, token, endpoint) { // Returns an array of file paths in current repo matching the fileName async function findFilePaths(fileName) { - logger.verbose("Can't find multiple package.json files in GitLab"); + logger.debug("Can't find multiple package.json files in GitLab"); return [fileName]; } diff --git a/lib/config/file.js b/lib/config/file.js index 56c608effc216944050fd2225924cc1f9289817f..c811d19900ab41fa10f3d07779948c5e1a21cfdf 100644 --- a/lib/config/file.js +++ b/lib/config/file.js @@ -16,7 +16,7 @@ function getConfig(env) { config = require(configFile); } catch (err) { // Do nothing - logger.verbose('Could not locate config file'); + logger.debug('Could not locate config file'); } return config; } diff --git a/lib/config/index.js b/lib/config/index.js index 38bd31ac6afde78ca1fcf1197df3bd1be84339b2..f80174eb3699e5359bf5f4cdad4fd20a2b4ce697 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -61,9 +61,7 @@ async function parseConfigs(env, argv) { throw new Error('A GitHub App Private Key must be provided'); } config.repositories = await githubAppHelper.getRepositories(config); - logger.verbose( - `Found ${config.repositories.length} repositories installed` - ); + logger.info(`Found ${config.repositories.length} repositories installed`); delete config.githubAppKey; logger.debug(`GitHub App config: ${JSON.stringify(config)}`); } else if (config.autodiscover) { @@ -123,7 +121,7 @@ async function parseConfigs(env, argv) { }); // Print config - logger.verbose(`config=${redact(config)}`); + logger.debug(`config=${redact(config)}`); } function getCascadedConfig(repo, packageFile) { diff --git a/lib/helpers/changelog.js b/lib/helpers/changelog.js index f8ab2f1800eb76852055d323c75e9575012c673c..ef61a821cd2e99687e7007834d66e46836cdf80f 100644 --- a/lib/helpers/changelog.js +++ b/lib/helpers/changelog.js @@ -17,7 +17,7 @@ async function getChangeLogJSON(depName, fromVersion, newVersion) { try { return await changelog.generate(depName, semverString); } catch (err) { - logger.verbose(`getChangeLogJSON error: ${JSON.stringify(err)}`); + logger.warn(`getChangeLogJSON error: ${JSON.stringify(err)}`); return null; } } diff --git a/lib/helpers/github-app.js b/lib/helpers/github-app.js index 92d0b5b99d1245b216e31d885744cc9dcf2fff31..d005b8eafe22fbe68c8b31a8a9c059199de67835 100644 --- a/lib/helpers/github-app.js +++ b/lib/helpers/github-app.js @@ -46,7 +46,7 @@ async function getRepositories(config) { config.githubAppKey ); const installations = await ghApi.getInstallations(appToken); - logger.verbose(`Found installations for ${installations.length} users`); + logger.info(`Found installations for ${installations.length} users`); for (const installation of installations) { logger.debug(JSON.stringify(installation)); const installationRepos = await module.exports.getUserRepositories( diff --git a/lib/helpers/versions.js b/lib/helpers/versions.js index c4f5481e95a7c9cd5cdbb4c24eb7e368a3bdbf9b..50b7a60ee708192f8a1882f7b9c4e095d29fe235 100644 --- a/lib/helpers/versions.js +++ b/lib/helpers/versions.js @@ -14,12 +14,12 @@ module.exports = { function determineUpgrades(dep, currentVersion, config) { if (!isValidVersion(currentVersion)) { - logger.verbose(`${dep.name} currentVersion is invalid`); + logger.warn(`${dep.name} currentVersion ${currentVersion} is invalid`); return []; } const versions = dep.versions; if (!versions || Object.keys(versions).length === 0) { - logger.verbose(`${dep.name} - no versions`); + logger.warn(`${dep.name} - no versions`); return []; } const versionList = Object.keys(versions); diff --git a/lib/index.js b/lib/index.js index 5ff6f4899a2ca5fe6596ac84ccd7e528abf661c4..5d2f252250387d1ebdab2edfbe730dc7a69cacd2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,6 +35,7 @@ async function start() { // Queue package files in sequence within a repo async function processRepo(repo) { + logger.info(`Processing repository ${repo.repository}`); // Take a copy of the config, as we will modify it const config = Object.assign({}, repo); if (config.platform === 'github') { diff --git a/lib/worker.js b/lib/worker.js index 0745ba980a9b0595a363286894f89eecfa3eec6e..eafed0f30792f5c5391dd180d5c6b210c41c74d8 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -25,12 +25,12 @@ async function processPackageFile(repoName, packageFile, packageConfig) { config = Object.assign({}, packageConfig); config.packageFile = packageFile; - logger.info(`Processing ${repoName} ${packageFile}`); + logger.info(`Processing package file ${repoName}:${packageFile}`); const packageContent = await config.api.getFileJson(packageFile); if (!packageContent) { - logger.verbose('No package.json content found - skipping'); + logger.warn('No package.json content found - skipping'); return []; } @@ -78,6 +78,7 @@ async function processPackageFile(repoName, packageFile, packageConfig) { upgrade.prBody = upgrade.yarnMaintenancePrBody; upgrades.push(upgrade); } + logger.info('Finished processing package file'); return upgrades; } @@ -158,12 +159,19 @@ async function findUpgrades(dependencies) { dep.config ); if (upgrades.length > 0) { - logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`); + const upgradeCount = upgrades.length === 1 + ? '1 upgrade' + : `${upgrades.length} upgrades`; + logger.info( + `Dependency ${dep.depName} has ${upgradeCount} available: ${upgrades.map( + upgrade => upgrade.newVersion + )}` + ); upgrades.forEach(upgrade => { allUpgrades.push(Object.assign({}, dep, upgrade)); }); } else { - logger.verbose(`${dep.depName}: No upgrades required`); + logger.debug(`${dep.depName}: No upgrades required`); } } const promiseArray = dependencies.map(dep => findDepUpgrades(dep)); @@ -175,9 +183,12 @@ async function findUpgrades(dependencies) { async function processUpgrades(upgrades) { if (upgrades.length) { - logger.verbose('Processing upgrades'); + const upgradeCount = upgrades.length === 1 + ? '1 dependency upgrade' + : `${upgrades.length} dependency upgrades`; + logger.info(`Processing ${upgradeCount}`); } else { - logger.verbose('No upgrades to process'); + logger.info('No upgrades to process'); } logger.debug(`All upgrades: ${JSON.stringify(upgrades)}`); const branchUpgrades = {}; @@ -245,7 +256,14 @@ async function updateBranch(upgrades) { const branchName = handlebars.compile(upgrade0.branchName)(upgrade0); const prTitle = handlebars.compile(upgrade0.prTitle)(upgrade0); - logger.verbose(`branchName '${branchName}' length is ${upgrades.length}`); + const upgradeCount = upgrades.length === 1 + ? '1 upgrade' + : `${upgrades.length} upgrades`; + logger.info( + `Branch '${branchName}' has ${upgradeCount}: ${upgrades.map( + upgrade => upgrade.depName + )}` + ); try { if ( @@ -254,7 +272,7 @@ async function updateBranch(upgrades) { !upgrade0.recreateClosed && (await upgrade0.api.checkForClosedPr(branchName, prTitle)) ) { - logger.verbose( + logger.info( `Skipping ${branchName} upgrade as matching closed PR already existed` ); return; diff --git a/lib/workers/branch.js b/lib/workers/branch.js index 7f4b1e1e5f92583774f0fea060c4edefddd1a4b2..c34349f8a8a5b3a51a156eb83afb8d5c8a5df973 100644 --- a/lib/workers/branch.js +++ b/lib/workers/branch.js @@ -12,18 +12,18 @@ module.exports = { async function getParentBranch(branchName, config) { // Check if branch exists if ((await config.api.branchExists(branchName)) === false) { - logger.verbose(`Creating new branch ${branchName}`); + logger.info(`Branch ${branchName} needs creating`); return undefined; } - logger.debug(`${branchName} already exists`); + logger.info(`Branch ${branchName} already exists`); // Check if needs rebasing if ( - (config.automergeEnabled && config.automergeType === 'branch-push') || - config.rebaseStalePrs + config.rebaseStalePrs || + (config.automergeEnabled && config.automergeType === 'branch-push') ) { const isBranchStale = await config.api.isBranchStale(branchName); if (isBranchStale) { - logger.debug(`Branch ${branchName} is stale and needs rebasing`); + logger.info(`Branch ${branchName} is stale and needs rebasing`); return undefined; } } @@ -41,13 +41,13 @@ async function getParentBranch(branchName, config) { if (pr.canRebase) { // Only supported by GitHub // Setting parentBranch back to undefined means that we'll use the default branch - logger.debug(`Rebasing branch ${branchName}`); + logger.debug(`Branch ${branchName} is not mergeable and needs rebasing`); return undefined; } // Don't do anything different, but warn - logger.verbose(`Cannot rebase branch ${branchName}`); + logger.warn(`Branch ${branchName} is not mergeable but can't be rebased`); } - logger.debug(`Existing ${branchName} does not need rebasing`); + logger.debug(`Branch ${branchName} does not need rebasing`); return branchName; } @@ -105,7 +105,7 @@ async function ensureBranch(upgrades) { } } if (Object.keys(packageFiles).length > 0) { - logger.debug( + logger.info( `${Object.keys(packageFiles).length} package file(s) need updating.` ); for (const packageFile of Object.keys(packageFiles)) { @@ -123,7 +123,7 @@ async function ensureBranch(upgrades) { ); if (yarnLockFile) { // Add new yarn.lock file too - logger.debug(`Adding ${yarnLockFile.name}`); + logger.info(`Adding ${yarnLockFile.name}`); commitFiles.push(yarnLockFile); } } catch (err) { @@ -138,12 +138,12 @@ async function ensureBranch(upgrades) { ); if (packageLockFile) { // Add new package-lock.json file too - logger.debug(`Adding ${packageLockFile.name}`); + logger.info(`Adding ${packageLockFile.name}`); commitFiles.push(packageLockFile); } } catch (err) { // This will include if npm < 5 - logger.verbose(err); + logger.debug(err); throw new Error('Could not generate new package-lock.json file'); } } diff --git a/lib/workers/pr.js b/lib/workers/pr.js index 9543d1e74bb8c67eee484414d512765e314989c6..79db40482beaa41f7c94e0954ac6aace89337690 100644 --- a/lib/workers/pr.js +++ b/lib/workers/pr.js @@ -106,7 +106,7 @@ async function ensurePr(upgrades) { if (existingPr) { // Check if existing PR needs updating if (existingPr.title === prTitle && existingPr.body === prBody) { - logger.verbose(`${existingPr.displayNumber} already up-to-date`); + logger.info(`${existingPr.displayNumber} does not need updating`); return existingPr; } // PR must need updating @@ -143,24 +143,24 @@ async function ensurePr(upgrades) { async function checkAutoMerge(pr, config) { logger.debug(`Checking #${pr.number} for automerge`); if (config.automergeEnabled && config.automergeType === 'pr') { - logger.verbose('PR is configured for automerge'); + logger.info('PR is configured for automerge'); logger.debug(JSON.stringify(pr)); // Return if PR not ready for automerge if (pr.mergeable !== true || pr.mergeable_state === 'unstable') { - logger.verbose('PR is not ready for merge'); + logger.info('PR is not ready for merge'); return; } // Check branch status const branchStatus = await config.api.getBranchStatus(pr.head.ref); logger.debug(`branchStatus=${branchStatus}`); if (branchStatus !== 'success') { - logger.verbose('Branch status is not "success"'); + logger.info('Branch status is not "success"'); return; } // Let's merge this logger.info(`Automerging #${pr.number}`); await config.api.mergePr(pr); } else { - logger.verbose('No automerge'); + logger.debug('No automerge'); } }