diff --git a/lib/workers/branch/auto-replace.ts b/lib/workers/branch/auto-replace.ts index eb5259a26ad2ce5f8a83965b3ee132109834f093..aa8f4f15331cb00d0c800f17f8a146923db73480 100644 --- a/lib/workers/branch/auto-replace.ts +++ b/lib/workers/branch/auto-replace.ts @@ -105,6 +105,7 @@ export async function doAutoReplace( return existingContent; } const { + packageFile, depName, currentValue, newValue, @@ -117,7 +118,7 @@ export async function doAutoReplace( let searchIndex = existingContent.indexOf(replaceString); if (searchIndex === -1) { logger.warn( - { depName, existingContent, replaceString }, + { packageFile, depName, existingContent, replaceString }, 'Cannot find replaceString in current file content' ); return existingContent; @@ -141,12 +142,18 @@ export async function doAutoReplace( ); } } - logger.debug(`Starting search at index ${searchIndex}`); + logger.debug( + { packageFile, depName }, + `Starting search at index ${searchIndex}` + ); // Iterate through the rest of the file for (; searchIndex < existingContent.length; searchIndex += 1) { // First check if we have a hit for the old version if (matchAt(existingContent, searchIndex, replaceString)) { - logger.debug(`Found match at index ${searchIndex}`); + logger.debug( + { packageFile, depName }, + `Found match at index ${searchIndex}` + ); // Now test if the result matches const testContent = replaceAt( existingContent, @@ -163,7 +170,7 @@ export async function doAutoReplace( } } } catch (err) /* istanbul ignore next */ { - logger.debug({ err }, 'doAutoReplace error'); + logger.debug({ packageFile, depName, err }, 'doAutoReplace error'); } // istanbul ignore next throw new Error(WORKER_FILE_UPDATE_FAILED); diff --git a/lib/workers/branch/get-updated.ts b/lib/workers/branch/get-updated.ts index 0135953cc7e36758c1f8687e7e4f20c62027f660..249c4ebdf2aa6d3171698c7a7fc90de6c5042be8 100644 --- a/lib/workers/branch/get-updated.ts +++ b/lib/workers/branch/get-updated.ts @@ -39,7 +39,10 @@ export async function getUpdatedPackageFiles( (await platform.getFile(packageFile, config.parentBranch)); // istanbul ignore if if (config.parentBranch && !existingContent) { - logger.debug('Rebasing branch after file not found'); + logger.debug( + { packageFile, depName }, + 'Rebasing branch after file not found' + ); return getUpdatedPackageFiles({ ...config, parentBranch: undefined, @@ -50,9 +53,9 @@ export async function getUpdatedPackageFiles( const res = await doAutoReplace(upgrade, existingContent, parentBranch); if (res) { if (res === existingContent) { - logger.debug('No content changed'); + logger.debug({ packageFile, depName }, 'No content changed'); } else { - logger.debug('Contents updated'); + logger.debug({ packageFile, depName }, 'Contents updated'); updatedFileContents[packageFile] = res; } continue; // eslint-disable-line no-continue @@ -62,7 +65,7 @@ export async function getUpdatedPackageFiles( parentBranch: undefined, }); } - logger.error('Could not autoReplace'); + logger.error({ packageFile, depName }, 'Could not autoReplace'); throw new Error(WORKER_FILE_UPDATE_FAILED); } const newContent = await updateDependency({ @@ -71,7 +74,10 @@ export async function getUpdatedPackageFiles( }); if (!newContent) { if (config.parentBranch) { - logger.debug('Rebasing branch after error updating content'); + logger.debug( + { packageFile, depName }, + 'Rebasing branch after error updating content' + ); return getUpdatedPackageFiles({ ...config, parentBranch: undefined, @@ -86,13 +92,16 @@ export async function getUpdatedPackageFiles( if (newContent !== existingContent) { if (config.parentBranch) { // This ensure it's always 1 commit from the bot - logger.debug('Need to update package file so will rebase first'); + logger.debug( + { packageFile, depName }, + 'Need to update package file so will rebase first' + ); return getUpdatedPackageFiles({ ...config, parentBranch: undefined, }); } - logger.debug('Updating packageFile content'); + logger.debug({ packageFile, depName }, 'Updating packageFile content'); updatedFileContents[packageFile] = newContent; } if (