Skip to content

ref(maven): Improve logging for maven target - #275

Merged
iker-barriocanal merged 5 commits into
masterfrom
iker/ref/maven-logging
Aug 19, 2021
Merged

ref(maven): Improve logging for maven target#275
iker-barriocanal merged 5 commits into
masterfrom
iker/ref/maven-logging

Conversation

@iker-barriocanal

@iker-barriocanal iker-barriocanal commented Aug 17, 2021

Copy link
Copy Markdown
Contributor
  • Don't log when not finding BOMs. Most of the packages aren't supposed to be BOM files, and logging this may give the impression that something is missing when it's not.
  • Add a note to the target's docs to show command output when the log level is trace.

Most of the packages aren't supposed to be BOM files, and logging this may give the impression
that something is missing when it's not.
@iker-barriocanal
iker-barriocanal requested a review from a team August 17, 2021 09:51
@iker-barriocanal iker-barriocanal self-assigned this Aug 17, 2021
@iker-barriocanal
iker-barriocanal requested review from AbhiPrasad and vladanpaunovic and removed request for a team August 17, 2021 09:51
Comment thread src/targets/maven.ts Outdated
Comment on lines +417 to +418
if (output) {
if (output.length === 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can combine this conditional.

Comment thread src/targets/maven.ts Outdated
private logCmdOutput(output: Buffer | undefined): void {
if (output) {
if (output.length === 0) {
this.logger.debug(`The command didn't have any output.`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to know what the command is from this statement, would be helpful to have some details about the command

Comment thread src/targets/maven.ts Outdated
: `${moduleName}.jar`;
}

private logCmdOutput(output: Buffer | undefined): void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need any of this as spawnProcess does it underneath:

craft/src/utils/system.ts

Lines 174 to 182 in a015c79

child.stdout.pipe(split()).on('data', (data: any) => {
const output = `${command}: ${data}`;
if (spawnProcessOptions.showStdout) {
logger.info(output);
} else {
logger.trace(output);
}
stdout += `${output}\n`;
});

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the motivation behind the this.logger.level >= LogLevel.Debug condition.

spawnProcess already logs with level info if this is true at all times. If we want to see the output for debugging purposes, we can always set the logging level to trace for that specific session, right?

Comment thread src/targets/maven.ts Outdated
this.mavenConfig.mavenSettingsPath,
],
{},
{ showStdout: this.logger.level >= LogLevel.Debug }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing this?

@iker-barriocanal
iker-barriocanal requested a review from BYK August 18, 2021 11:57
@iker-barriocanal
iker-barriocanal merged commit cc1afed into master Aug 19, 2021
@iker-barriocanal
iker-barriocanal deleted the iker/ref/maven-logging branch August 19, 2021 09:33
@BYK BYK added this to the Added Maven Target milestone Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants