Add time stamp into the ti log.

This commit is contained in:
Sheetal Nandi
2018-04-03 13:02:27 -07:00
parent c466a4541e
commit e304178c65
3 changed files with 9 additions and 8 deletions

View File

@@ -211,12 +211,6 @@ namespace ts.server {
}
}
// E.g. "12:34:56.789"
function nowString() {
const d = new Date();
return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`;
}
interface QueuedOperation {
operationId: string;
operation: () => void;

View File

@@ -33,4 +33,11 @@ namespace ts.server {
? sys.args[index + 1]
: undefined;
}
}
/*@internal*/
export function nowString() {
// E.g. "12:34:56.789"
const d = new Date();
return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`;
}
}

View File

@@ -21,7 +21,7 @@ namespace ts.server.typingsInstaller {
}
writeLine = (text: string) => {
try {
fs.appendFileSync(this.logFile, text + sys.newLine);
fs.appendFileSync(this.logFile, `[${nowString()}] ${text}${sys.newLine}`);
}
catch (e) {
this.logEnabled = false;