Skip to content

Commit

Permalink
fix: improve message to output: meta not displayed (#250)
Browse files Browse the repository at this point in the history
Signed-off-by: Hervé Boutemy <[email protected]>
  • Loading branch information
hboutemy authored Aug 3, 2023
1 parent e15fa5b commit ed58962
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
8 changes: 4 additions & 4 deletions ext-src/models/IqMultiProjectComponentModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export class IqMultiProjectComponentModel implements ComponentModel {
progress.report({ message: "Starting to package your dependencies for IQ Server", increment: 5 });
for (let pm of componentContainer.Valid) {
try {
this.logger.log(LogLevel.INFO, `Starting to Munch on ${pm.constructor.name} dependencies`);
this.logger.log(LogLevel.INFO, `Starting to munch on ${pm.constructor.name} dependencies`);
const deps = await pm.packageForService();
this.logger.log(LogLevel.TRACE, `Obtained ${deps.length} Dependencies from Muncher ${pm.constructor.name}`, deps);
this.logger.log(LogLevel.TRACE, `Obtained ${deps.length} dependencies from Muncher ${pm.constructor.name}`, deps);
dependencies.push(...deps);
progress.report({ message: "Reticulating Splines", increment: 25 });

Expand All @@ -124,7 +124,7 @@ export class IqMultiProjectComponentModel implements ComponentModel {
this.logger.log(LogLevel.TRACE, `Total components is now ${application.coordsToComponent.size}`);

} catch (ex) {
this.logger.log(LogLevel.ERROR, `Nexus IQ Extension Failure moving forward`, ex);
this.logger.log(LogLevel.ERROR, `Nexus IQ extension failure, moving forward, exception: ${ex}`, ex);
window.showErrorMessage(`Nexus IQ extension failure, moving forward, exception: ${ex}`);
return
}
Expand Down Expand Up @@ -218,7 +218,7 @@ export class IqMultiProjectComponentModel implements ComponentModel {
window.setStatusBarMessage(`Nexus IQ Server Results in, build with confidence!`, 5000);
},
(failure) => {
this.logger.log(LogLevel.ERROR, `Nexus IQ extension failure`, failure);
this.logger.log(LogLevel.ERROR, `Nexus IQ extension failure: ${failure}`, failure);
if (failure == 403) {
window.showErrorMessage('Nexus IQ extension: Insufficient Permissions (403) - do you hold the Application Evaluator role for your Application?')
} else {
Expand Down
2 changes: 1 addition & 1 deletion ext-src/packages/gradle/GradleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GradleUtils {
private readonly gradleArgumentsTest = `dependencies --configuration testRuntimeClasspath`;

public async getDependencyArray(application: Application, includeDev: boolean = true): Promise<any> {
this.logger.log(LogLevel.DEBUG, `Starting to attempt to get gradle dependencies`);
this.logger.log(LogLevel.DEBUG, `Starting to attempt to get Gradle dependencies`);

let gradleCommandBaseCommand: string = "";
let gradleCommand: string = "";
Expand Down
40 changes: 20 additions & 20 deletions ext-src/services/IqRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class IqRequestService implements RequestService {
) {
this.setURL(url);

this.logger.log(LogLevel.INFO, `Created new IQ Request Service at: `, url);
this.logger.log(LogLevel.INFO, `Created new IQ Request Service at: ${url}`);
}

public setOptions(options: RefreshOptions) {
Expand All @@ -61,7 +61,7 @@ export class IqRequestService implements RequestService {
}

public setURL(url: string) {
this.logger.log(LogLevel.TRACE, `Setting IQ url to: `, this.url);
this.logger.log(LogLevel.TRACE, `Setting IQ url to: ${this.url}`);

this.url = url.replace(/\/$/, "");

Expand Down Expand Up @@ -133,15 +133,15 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.TRACE,
`Non 200 response from getting application ID`, url, body, res.status
);
`Non 200 response from getting application ID: ${res.status}`, url, body, res.status
);
reject(res.status);
return;
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`Error getting application ID from public ID`, url, ex
);
`Error getting application ID from public ID: ${ex}`, url, ex
);
reject(ex);
});
});
Expand Down Expand Up @@ -170,7 +170,7 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.TRACE,
`Non 200 response from IQ Server on submitting to 3rd Party API`,
`Non 200 response from IQ Server on submitting to 3rd Party API: ${res.status}`,
body,
res.status
);
Expand All @@ -179,8 +179,8 @@ export class IqRequestService implements RequestService {
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`Error submitting to 3rd Party API`, ex
);
`Error submitting to 3rd Party API: ${ex}`, ex
);
reject(ex);
});
});
Expand Down Expand Up @@ -256,7 +256,7 @@ export class IqRequestService implements RequestService {
return;
}
let body = await res.text();
this.logger.log(LogLevel.ERROR, `Issue getting report result`, url, body);
this.logger.log(LogLevel.ERROR, `Issue getting report result: ${res.status}`, url, body);
reject(res.status);
return;
}).catch((ex) => {
Expand Down Expand Up @@ -313,7 +313,7 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.ERROR,
`Non 200 response attempting to get remediation details: ${purl}`,
`Non 200 response attempting to get remediation details: : ${res.status} for ${purl}`,
request,
body,
url
Expand All @@ -323,7 +323,7 @@ export class IqRequestService implements RequestService {
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`General error attempting to get remediation details: ${purl}`,
`General error attempting to get remediation details: ${purl} resulted in ${ex}`,
request,
ex,
url
Expand Down Expand Up @@ -352,15 +352,15 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.ERROR,
`Non 200 response attempting to get vuln details: ${vulnID}`,
`Non 200 response attempting to get vuln details: : ${res.status} for ${vulnID}`,
body,
url);
reject(res.status);
return;
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`General error attempting to get vuln details: ${vulnID}`,
`General error attempting to get vuln details: ${vulnID} resulted in ${ex}`,
ex,
url);
reject(ex);
Expand Down Expand Up @@ -392,7 +392,7 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.ERROR,
`Non 200 response received getting versions array from IQ Server`,
`Non 200 response received getting versions array from IQ Server: ${res.status}`,
request,
res.status,
body);
Expand All @@ -401,7 +401,7 @@ export class IqRequestService implements RequestService {
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`General error getting versions array from IQ Server`,
`General error getting versions array from IQ Server: ${ex}`,
request,
ex);
reject(ex);
Expand Down Expand Up @@ -440,7 +440,7 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.ERROR,
`Non 200 response received getting component versions details from IQ Server`,
`Non 200 response received getting component versions details from IQ Server: ${res.status}`,
request,
res.status,
body);
Expand All @@ -449,7 +449,7 @@ export class IqRequestService implements RequestService {
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`General error getting component versions details from IQ Server`,
`General error getting component versions details from IQ Server: ${ex}`,
request,
ex);
reject(ex);
Expand Down Expand Up @@ -483,7 +483,7 @@ export class IqRequestService implements RequestService {
let body = await res.text();
this.logger.log(
LogLevel.ERROR,
`Non 200 response received getting component version details from IQ Server`,
`Non 200 response received getting component version details from IQ Server: ${res.status}`,
request,
res.status,
body);
Expand All @@ -492,7 +492,7 @@ export class IqRequestService implements RequestService {
}).catch((ex) => {
this.logger.log(
LogLevel.ERROR,
`General error getting component version details from IQ Server`,
`General error getting component version details from IQ Server: ${ex}`,
request,
ex);
reject(ex);
Expand Down
1 change: 1 addition & 0 deletions ext-src/utils/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class Logger implements ILogger {
this._writeToOutputChannel(LogLevel.INFO, `Log Level set to: ${LogLevel[logLevel]}`);
}

// ignore meta information in output channel, keep them only in log file
public log(level: LogLevel, message: string, ...meta: any): void {
if (this._logLevel >= level) {
this._writeToOutputChannel(level, message);
Expand Down

0 comments on commit ed58962

Please sign in to comment.