mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:39:46 -05:00
Add time stamp into the ti log.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user