Skip to content

Commit 07c64a5

Browse files
Merge pull request #5171 from NativeScript/vladimirov/improve-log-trace
chore: improve log trace messages
2 parents b0cf146 + eb974ab commit 07c64a5

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

lib/common/dispatchers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export class CommandDispatcher implements ICommandDispatcher {
1919
// CommandDispatcher is called from external CLI's only, so pass the path to their package.json
2020
const sysInfo = await this.$sysInfo.getSysInfo({ pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json") });
2121
this.$logger.trace("System information:");
22-
this.$logger.trace(sysInfo);
22+
this.$logger.trace(JSON.stringify(sysInfo, null, 2));
23+
this.$logger.trace("Current CLI version: ", this.$staticConfig.version);
2324
}
2425

2526
let commandName = this.getCommandName();

lib/nativescript-cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const originalProcessOn = process.on;
1212

1313
process.on = (event: string, listener: any): any => {
1414
if (event === "SIGINT") {
15-
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);
15+
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.`);
16+
const msg = "The stackTrace of the location trying to handle SIGINT is:";
17+
const stackTrace = new Error(msg).stack || '';
18+
logger.trace(stackTrace.replace(`Error: ${msg}`, msg));
1619
} else {
1720
return originalProcessOn.apply(process, [event, listener]);
1821
}

lib/services/project-changes-service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ export class ProjectChangesService implements IProjectChangesService {
229229
const dirName = path.basename(dir);
230230
this.$logger.trace(`containsNewerFiles will check ${dir}`);
231231
if (_.startsWith(dirName, '.')) {
232-
this.$logger.trace(`containsNewerFiles returns false for ${dir} as its name starts with dot (.) .`);
233232
return false;
234233
}
235234

@@ -258,7 +257,6 @@ export class ProjectChangesService implements IProjectChangesService {
258257
}
259258
}
260259

261-
this.$logger.trace(`containsNewerFiles returns false for ${dir}.`);
262260
return false;
263261
}
264262

lib/services/webpack/webpack-compiler-service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
3333
const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
3434

3535
childProcess.on("message", (message: string | IWebpackEmitMessage) => {
36+
this.$logger.trace("Message from webpack", message);
37+
3638
if (message === "Webpack compilation complete.") {
3739
this.$logger.info("Webpack build done!");
3840
resolve(childProcess);
@@ -74,6 +76,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
7476
platform: platformData.platformNameLowerCase
7577
};
7678

79+
this.$logger.trace("Generated data from webpack message:", data);
7780
if (data.files.length) {
7881
this.emit(WEBPACK_COMPILATION_COMPLETE, data);
7982
}

0 commit comments

Comments
 (0)