Skip to content

Commit

Permalink
Clean up log messages related to Lieutenant API
Browse files Browse the repository at this point in the history
Use the logger's record functionality to provide specific information
for the log messages instead of string interpolation.
  • Loading branch information
simu committed Jan 14, 2022
1 parent 44c5313 commit 3a1a592
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/commodore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,39 @@ export async function extractPackageFile(
if (config.lieutenantURL && config.lieutenantURL != '') {
if (config.lieutenantToken == '') {
logger.warn(
`Lieutenant token is empty. Renovate won't try to query the Lieutenant API at ${config.lieutenantURL}`
{
cluster: cluster.name,
lieutenantURL: config.lieutenantURL,
},
"Lieutenant token is empty. Renovate won't try to query the Lieutenant API"
);
} else {
logger.info(`Querying Lieutenant at ${config.lieutenantURL}`);
logger.debug(
{
lieutenantURL: config.lieutenantURL,
},
'Querying Lieutenant'
);
try {
clusterInfo = await fetchClusterInfo(config, cluster.name);
} catch (error: any) {
if (error instanceof LieutenantError) {
const err = error as LieutenantError;
if (err.statusCode == 404) {
logger.debug(`Lieutenant query returned 404 for ${cluster.name}`);
logger.debug(
{
cluster: cluster.name,
},
'Lieutenant query returned 404'
);
} else {
logger.info(
`Error querying Lieutenant for ${cluster.name}: statusCode=${err.statusCode}, reason=${err.message}`
{
cluster: cluster.name,
statusCode: err.statusCode,
reason: err.message,
},
'Error querying Lieutenant'
);
}
} else {
Expand Down

0 comments on commit 3a1a592

Please sign in to comment.