Browse Source

Refines logging

main
Eric Amodio 1 year ago
parent
commit
0b4bab9eed
3 changed files with 8 additions and 6 deletions
  1. +1
    -1
      src/extension.ts
  2. +6
    -5
      src/trackers/lineTracker.ts
  3. +1
    -0
      src/webviews/webviewsController.ts

+ 1
- 1
src/extension.ts View File

@ -220,7 +220,7 @@ export async function activate(context: ExtensionContext): Promise
const elapsed = sw.elapsed();
sw.stop({
message: ` activated${exitMessage != null ? `, ${exitMessage}` : ''}${
message: `activated${exitMessage != null ? `, ${exitMessage}` : ''}${
mode != null ? `, mode: ${mode.name}` : ''
}`,
});

+ 6
- 5
src/trackers/lineTracker.ts View File

@ -3,8 +3,7 @@ import { Disposable, EventEmitter, window } from 'vscode';
import { debug } from '../system/decorators/log';
import type { Deferrable } from '../system/function';
import { debounce } from '../system/function';
import { Logger } from '../system/logger';
import { getLogScope } from '../system/logger.scope';
import { getLogScope, setLogScopeExit } from '../system/logger.scope';
import { isTextEditor } from '../system/utils';
export interface LinesChangeEvent {
@ -119,7 +118,7 @@ export class LineTracker implements Disposable {
protected onStart?(): Disposable | undefined;
@debug({ args: false })
@debug({ args: false, singleLine: true })
subscribe(subscriber: unknown, subscription: Disposable): Disposable {
const scope = getLogScope();
@ -138,7 +137,7 @@ export class LineTracker implements Disposable {
}
if (first) {
Logger.debug(scope, 'Starting line tracker...');
setLogScopeExit(scope, ' \u2022 starting line tracker...');
this._disposable = Disposable.from(
window.onDidChangeActiveTextEditor(debounce(this.onActiveTextEditorChanged, 0), this),
@ -147,12 +146,14 @@ export class LineTracker implements Disposable {
);
queueMicrotask(() => this.onActiveTextEditorChanged(window.activeTextEditor));
} else {
setLogScopeExit(scope, ' \u2022 already started...');
}
return disposable;
}
@debug({ args: false })
@debug({ args: false, singleLine: true })
unsubscribe(subscriber: unknown) {
const subs = this._subscriptions.get(subscriber);
if (subs == null) return;

+ 1
- 0
src/webviews/webviewsController.ts View File

@ -121,6 +121,7 @@ export class WebviewsController implements Disposable {
1: false,
2: false,
},
singleLine: true,
})
registerWebviewView<State, SerializedState = State, ShowingArgs extends unknown[] = unknown[]>(
descriptor: WebviewViewDescriptor,

Loading…
Cancel
Save