fix: less debug logging, more trace

This commit is contained in:
Rhys Arkins 2019-04-28 22:08:06 +02:00
parent 5aed5026c6
commit f68414fb2f
7 changed files with 10 additions and 13 deletions

View file

@ -67,7 +67,7 @@ async function getAuthHeaders(registry, repository) {
// prettier-ignore
const authUrl = `${authenticateHeader.parms.realm}?service=${authenticateHeader.parms.service}&scope=repository:${repository}:pull`;
logger.debug(
logger.trace(
`Obtaining docker registry token for ${repository} using url ${authUrl}`
);
const { token } = (await got(authUrl, opts)).body;

View file

@ -13,7 +13,7 @@ function extractPackageFile(content) {
if (match) {
const currentFrom = match[1];
const dep = getDep(currentFrom);
logger.debug(
logger.trace(
{
depName: dep.depName,
currentValue: dep.currentValue,

View file

@ -45,7 +45,7 @@ function extractPackageFile(content) {
for (const fromLine of content.split('\n')) {
const fromMatch = fromLine.match(/^FROM /i);
if (fromMatch) {
logger.debug({ lineNumber, fromLine }, 'FROM line');
logger.trace({ lineNumber, fromLine }, 'FROM line');
const [fromPrefix, currentFrom, ...fromRest] = fromLine.match(/\S+/g);
if (fromRest.length === 2 && fromRest[0].toLowerCase() === 'as') {
logger.debug('Found a multistage build stage name');
@ -76,7 +76,7 @@ function extractPackageFile(content) {
const copyFromMatch = fromLine.match(/^(COPY --from=)([^\s]+)\s+(.*)$/i);
if (copyFromMatch) {
const [fromPrefix, currentFrom, fromSuffix] = copyFromMatch.slice(1);
logger.debug({ lineNumber, fromLine }, 'COPY --from line');
logger.trace({ lineNumber, fromLine }, 'COPY --from line');
if (stageNames.includes(currentFrom)) {
logger.debug({ currentFrom }, 'Skipping alias COPY --from');
} else if (!Number.isNaN(Number(currentFrom))) {

View file

@ -36,8 +36,7 @@ function getDep(lineNumber, match) {
}
function extractPackageFile(content) {
logger.debug('gomod.extractPackageFile()');
logger.trace({ content });
logger.trace({ content }, 'gomod.extractPackageFile()');
const deps = [];
try {
const lines = content.split('\n');
@ -45,8 +44,7 @@ function extractPackageFile(content) {
let line = lines[lineNumber];
const requireMatch = line.match(/^require\s+([^\s]+)\s+([^\s]+)/);
if (requireMatch) {
logger.trace(`Matched single-line require on line ${lineNumber}`);
logger.debug(`require line: "${line}"`);
logger.trace({ lineNumber }, `require line: "${line}"`);
const dep = getDep(lineNumber, requireMatch);
deps.push(dep);
}
@ -58,8 +56,7 @@ function extractPackageFile(content) {
const multiMatch = line.match(/^\s+([^\s]+)\s+([^\s]+)/);
logger.trace(`reqLine: "${line}"`);
if (multiMatch) {
logger.trace(`Matched multi-line require on line ${lineNumber}`);
logger.debug(`require line: "${line}"`);
logger.trace({ lineNumber }, `require line: "${line}"`);
const dep = getDep(lineNumber, multiMatch);
dep.multiLine = true;
deps.push(dep);

View file

@ -36,7 +36,7 @@ async function extractAllPackageFiles(config, packageFiles) {
}
async function extractPackageFile(content, fileName, config) {
logger.debug(`npm.extractPackageFile(${fileName})`);
logger.trace(`npm.extractPackageFile(${fileName})`);
logger.trace({ content });
const deps = [];
let packageJson;

View file

@ -51,7 +51,7 @@ async function fetchDepUpdates(packageFileConfig, dep) {
}
// istanbul ignore if
if (dep.updates.length) {
logger.debug(
logger.trace(
{ dependency: depName },
`${dep.updates.length} result(s): ${dep.updates.map(
upgrade => upgrade.newValue

View file

@ -75,7 +75,7 @@ async function lookupUpdates(config) {
.filter(v => isVersion(v));
// istanbul ignore if
if (allVersions.length === 0) {
const message = `No valid versions returned from registry for this package`;
const message = `Found no results from datasource that look like a version`;
logger.debug({ dependency: depName, result: dependency }, message);
if (!config.currentDigest) {
return res;