Skip to content

chore: improve log trace messages #5171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/common/dispatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class CommandDispatcher implements ICommandDispatcher {
// CommandDispatcher is called from external CLI's only, so pass the path to their package.json
const sysInfo = await this.$sysInfo.getSysInfo({ pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json") });
this.$logger.trace("System information:");
this.$logger.trace(sysInfo);
this.$logger.trace(JSON.stringify(sysInfo, null, 2));
this.$logger.trace("Current CLI version: ", this.$staticConfig.version);
}

let commandName = this.getCommandName();
Expand Down
5 changes: 4 additions & 1 deletion lib/nativescript-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const originalProcessOn = process.on;

process.on = (event: string, listener: any): any => {
if (event === "SIGINT") {
logger.trace(new Error(`Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal`).stack);
logger.trace(`Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.`);
const msg = "The stackTrace of the location trying to handle SIGINT is:";
const stackTrace = new Error(msg).stack || '';
logger.trace(stackTrace.replace(`Error: ${msg}`, msg));
} else {
return originalProcessOn.apply(process, [event, listener]);
}
Expand Down
2 changes: 0 additions & 2 deletions lib/services/project-changes-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ export class ProjectChangesService implements IProjectChangesService {
const dirName = path.basename(dir);
this.$logger.trace(`containsNewerFiles will check ${dir}`);
if (_.startsWith(dirName, '.')) {
this.$logger.trace(`containsNewerFiles returns false for ${dir} as its name starts with dot (.) .`);
return false;
}

Expand Down Expand Up @@ -258,7 +257,6 @@ export class ProjectChangesService implements IProjectChangesService {
}
}

this.$logger.trace(`containsNewerFiles returns false for ${dir}.`);
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/services/webpack/webpack-compiler-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);

childProcess.on("message", (message: string | IWebpackEmitMessage) => {
this.$logger.trace("Message from webpack", message);

if (message === "Webpack compilation complete.") {
this.$logger.info("Webpack build done!");
resolve(childProcess);
Expand Down Expand Up @@ -74,6 +76,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
platform: platformData.platformNameLowerCase
};

this.$logger.trace("Generated data from webpack message:", data);
if (data.files.length) {
this.emit(WEBPACK_COMPILATION_COMPLETE, data);
}
Expand Down