Skip to content

Commit

Permalink
style: prettify output log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricbet committed Dec 24, 2024
1 parent 1098647 commit ee24c79
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/extension/src/hosted/api/vscode/ext.host.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ export class LogOutputChannelImpl extends OutputChannelImpl implements types.Log
}

private now(): string {
const toTwoDigits = (v: number) => (v < 10 ? `0${v}` : v);
const toThreeDigits = (v: number) => (v < 10 ? `00${v}` : v < 100 ? `0${v}` : v);
const twoDigits = (v: number) => (v < 10 ? `0${v}` : v);
const threeDigits = (v: number) => (v < 10 ? `00${v}` : v < 100 ? `0${v}` : v);

const now = new Date();
const date = `${now.getFullYear()}-${toTwoDigits(now.getMonth() + 1)}-${toTwoDigits(now.getDate())}`;
const time = `${toTwoDigits(now.getHours())}:${toTwoDigits(now.getMinutes())}:${toTwoDigits(
const date = `${now.getFullYear()}-${twoDigits(now.getMonth() + 1)}-${twoDigits(now.getDate())}`;
const time = `${twoDigits(now.getHours())}:${twoDigits(now.getMinutes())}:${twoDigits(
now.getSeconds(),
)}.${toThreeDigits(now.getMilliseconds())}`;
)}.${threeDigits(now.getMilliseconds())}`;
return `${date} ${time}`;
}

Expand Down

0 comments on commit ee24c79

Please sign in to comment.