From c8e8b6221a9d5f371473e10bbf6cdc19801b96cc Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Wed, 8 Jul 2020 11:26:09 -0700 Subject: [PATCH 1/2] Log digest file name --- src/client/datascience/interactive-ipynb/digestStorage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/datascience/interactive-ipynb/digestStorage.ts b/src/client/datascience/interactive-ipynb/digestStorage.ts index cb6887c81725..7e8088d6b42d 100644 --- a/src/client/datascience/interactive-ipynb/digestStorage.ts +++ b/src/client/datascience/interactive-ipynb/digestStorage.ts @@ -3,7 +3,7 @@ import { inject, injectable } from 'inversify'; import * as os from 'os'; import * as path from 'path'; import { Uri } from 'vscode'; -import { traceError } from '../../common/logger'; +import { traceError, traceInfo } from '../../common/logger'; import { isFileNotFoundError } from '../../common/platform/errors'; import { IFileSystem } from '../../common/platform/types'; import { IExtensionContext } from '../../common/types'; @@ -27,6 +27,7 @@ export class DigestStorage implements IDigestStorage { const fileLocation = await this.getFileLocation(uri); // Since the signature is a hex digest, the character 'z' is being used to delimit the start and end of a single digest await this.fs.appendFile(fileLocation, `z${signature}z\n`); + traceInfo(`Wrote trust for ${uri.toString()} to ${fileLocation}`); } public async containsDigest(uri: Uri, signature: string) { From 2c3ea52efebe0cb6e07161a2abe566995735e8c1 Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Fri, 10 Jul 2020 14:38:22 -0700 Subject: [PATCH 2/2] Only log each notebook file once --- src/client/datascience/interactive-ipynb/digestStorage.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/datascience/interactive-ipynb/digestStorage.ts b/src/client/datascience/interactive-ipynb/digestStorage.ts index 7e8088d6b42d..3c1df3ca2fb2 100644 --- a/src/client/datascience/interactive-ipynb/digestStorage.ts +++ b/src/client/datascience/interactive-ipynb/digestStorage.ts @@ -14,6 +14,7 @@ import { IDigestStorage } from '../types'; export class DigestStorage implements IDigestStorage { public readonly key: Promise; private digestDir: Promise; + private loggedFileLocations = new Set(); constructor( @inject(IFileSystem) private fs: IFileSystem, @@ -27,7 +28,10 @@ export class DigestStorage implements IDigestStorage { const fileLocation = await this.getFileLocation(uri); // Since the signature is a hex digest, the character 'z' is being used to delimit the start and end of a single digest await this.fs.appendFile(fileLocation, `z${signature}z\n`); - traceInfo(`Wrote trust for ${uri.toString()} to ${fileLocation}`); + if (!this.loggedFileLocations.has(fileLocation)) { + traceInfo(`Wrote trust for ${uri.toString()} to ${fileLocation}`); + this.loggedFileLocations.add(fileLocation); + } } public async containsDigest(uri: Uri, signature: string) {