diff --git a/src/env/node/git/git.ts b/src/env/node/git/git.ts index 8b0be87..b874a43 100644 --- a/src/env/node/git/git.ts +++ b/src/env/node/git/git.ts @@ -84,12 +84,12 @@ function defaultExceptionHandler(ex: Error, cwd: string | undefined, start?: [nu if (msg != null && msg.length !== 0) { for (const warning of Object.values(GitWarnings)) { if (warning.test(msg)) { - const duration = start !== undefined ? `${getDurationMilliseconds(start)} ms` : ''; + const duration = start !== undefined ? ` [${getDurationMilliseconds(start)}ms]` : ''; Logger.warn( `[${cwd}] Git ${msg .trim() .replace(/fatal: /g, '') - .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)} ${GlyphChars.Dot} ${duration}`, + .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)}${duration}`, ); return ''; } @@ -201,12 +201,12 @@ export class Git { `[GIT ] ${gitCommand} ${GlyphChars.Dot} ${(exception.message || String(exception) || '') .trim() .replace(/fatal: /g, '') - .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)} ${GlyphChars.Dot} ${duration} ms${status}`, + .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)} [${duration}ms]${status}`, ); } else if (slow) { - Logger.warn(`[GIT ] ${gitCommand} ${GlyphChars.Dot} ${duration} ms${status}`); + Logger.warn(`[GIT ] ${gitCommand} [*${duration}ms]${status}`); } else { - Logger.log(`[GIT ] ${gitCommand} ${GlyphChars.Dot} ${duration} ms${status}`); + Logger.log(`[GIT ] ${gitCommand} [${duration}ms]${status}`); } this.logGitCommand( `${gitCommand}${exception != null ? ` ${GlyphChars.Dot} FAILED` : ''}${waiting ? ' (waited)' : ''}`, @@ -276,12 +276,12 @@ export class Git { `[SGIT ] ${gitCommand} ${GlyphChars.Dot} ${(exception.message || String(exception) || '') .trim() .replace(/fatal: /g, '') - .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)} ${GlyphChars.Dot} ${duration} ms${status}`, + .replace(/\r?\n|\r/g, ` ${GlyphChars.Dot} `)} [${duration}ms]${status}`, ); } else if (slow) { - Logger.warn(`[SGIT ] ${gitCommand} ${GlyphChars.Dot} ${duration} ms${status}`); + Logger.warn(`[SGIT ] ${gitCommand} [*${duration}ms]${status}`); } else { - Logger.log(`[SGIT ] ${gitCommand} ${GlyphChars.Dot} ${duration} ms${status}`); + Logger.log(`[SGIT ] ${gitCommand} [${duration}ms]${status}`); } this.logGitCommand( `${gitCommand}${exception != null ? ` ${GlyphChars.Dot} FAILED` : ''}`, diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index 4b2ee7a..3cf2509 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -369,9 +369,7 @@ export class LocalGitProvider implements GitProvider, Disposable { } else { Logger.log( scope, - `Git (${location.version}) found in ${location.path === 'git' ? 'PATH' : location.path} ${ - GlyphChars.Dot - } ${getDurationMilliseconds(start)} ms`, + `Git (${location.version}) found in ${location.path === 'git' ? 'PATH' : location.path} [${getDurationMilliseconds(start)}ms]`, ); } diff --git a/src/hovers/hovers.ts b/src/hovers/hovers.ts index 19a736a..3f4ed4f 100644 --- a/src/hovers/hovers.ts +++ b/src/hovers/hovers.ts @@ -298,14 +298,14 @@ async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRe !cfg.autolinks.enhanced || !CommitFormatter.has(cfg.detailsMarkdownFormat, 'message') ) { - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return undefined; } const remote = await Container.instance.git.getBestRemoteWithRichProvider(remotes); if (remote?.provider == null) { - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return undefined; } @@ -326,9 +326,9 @@ async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRe scope, `timed out ${ GlyphChars.Dash - } ${prCount} issue/pull request queries took too long (over ${timeout} ms) ${ - GlyphChars.Dot - } ${getDurationMilliseconds(start)} ms`, + } ${prCount} issue/pull request queries took too long (over ${timeout} ms) [${getDurationMilliseconds( + start, + )}ms]`, ); // const pending = [ @@ -350,11 +350,11 @@ async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRe } } - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return autolinks; } catch (ex) { - Logger.error(ex, scope, `failed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.error(ex, scope, `failed [${getDurationMilliseconds(start)}ms]`); return undefined; } @@ -373,7 +373,7 @@ async function getPullRequestForCommit( const start = hrtime(); if (!options?.pullRequests) { - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return undefined; } @@ -382,7 +382,7 @@ async function getPullRequestForCommit( includeDisconnected: true, }); if (remote?.provider == null) { - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return undefined; } @@ -390,7 +390,7 @@ async function getPullRequestForCommit( const { provider } = remote; const connected = provider.maybeConnected ?? (await provider.isConnected()); if (!connected) { - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return remote; } @@ -398,17 +398,17 @@ async function getPullRequestForCommit( try { const pr = await Container.instance.git.getPullRequestForCommit(ref, provider, { timeout: 250 }); - Logger.debug(scope, `completed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `completed [${getDurationMilliseconds(start)}ms]`); return pr; } catch (ex) { if (ex instanceof PromiseCancelledError) { - Logger.debug(scope, `timed out ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.debug(scope, `timed out [${getDurationMilliseconds(start)}ms]`); return ex; } - Logger.error(ex, scope, `failed ${GlyphChars.Dot} ${getDurationMilliseconds(start)} ms`); + Logger.error(ex, scope, `failed [${getDurationMilliseconds(start)}ms]`); return undefined; } diff --git a/src/system/decorators/log.ts b/src/system/decorators/log.ts index 73503e4..196806c 100644 --- a/src/system/decorators/log.ts +++ b/src/system/decorators/log.ts @@ -212,7 +212,7 @@ export function log any>(options?: LogOptions, deb const start = timed ? hrtime() : undefined; const logError = (ex: Error) => { - const timing = start !== undefined ? ` \u2022 ${getDurationMilliseconds(start)} ms` : emptyStr; + const timing = start !== undefined ? ` [${getDurationMilliseconds(start)}ms]` : emptyStr; if (singleLine) { Logger.error( ex, @@ -244,10 +244,10 @@ export function log any>(options?: LogOptions, deb duration = getDurationMilliseconds(start); if (duration > slowCallWarningThreshold) { exitLogFn = warnFn; - timing = ` \u2022 ${duration} ms (slow)`; + timing = ` [*${duration}ms] (slow)`; } else { exitLogFn = logFn; - timing = ` \u2022 ${duration} ms`; + timing = ` [${duration}ms]`; } } else { timing = emptyStr; diff --git a/src/system/stopwatch.ts b/src/system/stopwatch.ts index fe72364..3d8c381 100644 --- a/src/system/stopwatch.ts +++ b/src/system/stopwatch.ts @@ -1,5 +1,4 @@ import { hrtime } from '@env/hrtime'; -import { GlyphChars } from '../constants'; import type { LogProvider } from './logger'; import { defaultLogProvider } from './logger'; import { LogLevel } from './logger.constants'; @@ -111,7 +110,7 @@ export class Stopwatch { this.logProvider.log( ms > 250 ? LogLevel.Warn : this.logLevel, logScope, - `${prefix ? `${prefix} ${GlyphChars.Dot} ` : ''}${ms} ms${options?.suffix ?? ''}`, + `${prefix ? `${prefix} ` : ''}[${ms}ms]${options?.suffix ?? ''}`, ); }