Skip to content

Commit 2822b45

Browse files
authored
Merge pull request #107 from ngdenterprise/logging-improvements
Log to VS Code output channel. Fixes #105
2 parents cd82400 + f369bd8 commit 2822b45

26 files changed

+137
-84
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
99
### Changed
1010

1111
- The invoke file editor now supports editing invocation files that use arrays or objects as contract parameters
12+
- Extension logs are now also shown in the VS Code Output Panel
1213

1314
## [2.1.49] - 2021-06-21
1415

src/extension/activeConnection.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import BlockchainMonitorPool from "./blockchainMonitor/blockchainMonitorPool";
77
import BlockchainType from "./blockchainType";
88
import BlockchainsTreeDataProvider from "./vscodeProviders/blockchainsTreeDataProvider";
99
import IoHelpers from "./util/ioHelpers";
10-
import Log from "../shared/log";
10+
import Log from "./util/log";
1111

1212
const LOG_PREFIX = "ActiveConnection";
1313
const STATUS_PREFIX = "Neo:";
@@ -31,7 +31,8 @@ export default class ActiveConnection {
3131
private readonly blockchainMonitorPool: BlockchainMonitorPool
3232
) {
3333
this.connection = null;
34-
this.onChangeEmitter = new vscode.EventEmitter<BlockchainIdentifier | null>();
34+
this.onChangeEmitter =
35+
new vscode.EventEmitter<BlockchainIdentifier | null>();
3536
this.onChange = this.onChangeEmitter.event;
3637
this.statusBarItem = vscode.window.createStatusBarItem();
3738
}

src/extension/autoComplete.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ import AutoCompleteData from "../shared/autoCompleteData";
88
import BlockchainIdentifier from "./blockchainIdentifier";
99
import ContractDetector from "./fileDetectors/contractDetector";
1010
import dedupeAndSort from "./util/dedupeAndSort";
11-
import Log from "../shared/log";
11+
import Log from "./util/log";
1212
import NeoExpress from "./neoExpress/neoExpress";
1313
import NeoExpressDetector from "./fileDetectors/neoExpressDetector";
1414
import NeoExpressIo from "./neoExpress/neoExpressIo";
15-
import reverseBytes from "../panel/components/tracker/reverseBytes";
1615
import WalletDetector from "./fileDetectors/walletDetector";
1716

1817
const LOG_PREFIX = "AutoComplete";

src/extension/blockchainIdentifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as vscode from "vscode";
55
import BlockchainType from "./blockchainType";
66
import IoHelpers from "./util/ioHelpers";
77
import JSONC from "./util/JSONC";
8-
import Log from "../shared/log";
8+
import Log from "./util/log";
99
import posixPath from "./util/posixPath";
1010

1111
const LOG_PREFIX = "BlockchainIdentifier";

src/extension/blockchainMonitor/blockchainMonitorInternal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as vscode from "vscode";
77
import AddressInfo from "../../shared/addressInfo";
88
import ApplicationLog from "../../shared/applicationLog";
99
import BlockchainState from "./blockchainState";
10-
import Log from "../../shared/log";
10+
import Log from "../util/log";
1111

1212
const APP_LOG_CACHE_SIZE = 1024;
1313
const BLOCK_CACHE_SIZE = 1024;

src/extension/fileDetectors/contractDetector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as neonSc from "@cityofzion/neon-core/lib/sc";
55
import ActiveConnection from "../activeConnection";
66
import DetectorBase from "./detectorBase";
77
import JSONC from "../util/JSONC";
8-
import Log from "../../shared/log";
8+
import Log from "../util/log";
99

1010
const LOG_PREFIX = "ContractDetector";
1111
const SEARCH_PATTERN = "**/*.nef";

src/extension/fileDetectors/detectorBase.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from "vscode";
22

3-
import Log from "../../shared/log";
3+
import Log from "../util/log";
44
import posixPath from "../util/posixPath";
55

66
const LOG_PREFIX = "DetectorBase";
@@ -28,9 +28,8 @@ export default abstract class DetectorBase {
2828
this.onChangeEmitter = new vscode.EventEmitter<void>();
2929
this.onChange = this.onChangeEmitter.event;
3030
this.refresh();
31-
this.fileSystemWatcher = vscode.workspace.createFileSystemWatcher(
32-
searchPattern
33-
);
31+
this.fileSystemWatcher =
32+
vscode.workspace.createFileSystemWatcher(searchPattern);
3433
this.fileSystemWatcher.onDidChange(this.refresh, this);
3534
this.fileSystemWatcher.onDidCreate(this.refresh, this);
3635
this.fileSystemWatcher.onDidDelete(this.refresh, this);
@@ -46,9 +45,9 @@ export default abstract class DetectorBase {
4645

4746
async refresh() {
4847
Log.log(LOG_PREFIX, "Refreshing file list...", this.searchPattern);
49-
this.allFiles = (
50-
await vscode.workspace.findFiles(this.searchPattern)
51-
).map((_) => posixPath(_.fsPath));
48+
this.allFiles = (await vscode.workspace.findFiles(this.searchPattern)).map(
49+
(_) => posixPath(_.fsPath)
50+
);
5251
await this.processFiles();
5352
this.onChangeEmitter.fire();
5453
}

src/extension/fileDetectors/serverListDetector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import BlockchainIdentifier from "../blockchainIdentifier";
66
import DetectorBase from "./detectorBase";
77
import IoHelpers from "../util/ioHelpers";
88
import JSONC from "../util/JSONC";
9-
import Log from "../../shared/log";
9+
import Log from "../util/log";
1010
import posixPath from "../util/posixPath";
1111

1212
const LOG_PREFIX = "ServerListDetector";

src/extension/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "./commands/commandArguments";
1313
import ContractDetector from "./fileDetectors/contractDetector";
1414
import ContractsTreeDataProvider from "./vscodeProviders/contractsTreeDataProvider";
15-
import Log from "../shared/log";
15+
import Log from "./util/log";
1616
import NeoCommands from "./commands/neoCommands";
1717
import NeoExpress from "./neoExpress/neoExpress";
1818
import NeoExpressCommands from "./commands/neoExpressCommands";
@@ -43,7 +43,8 @@ function registerCommand(
4343
commandArguments.path = (context as vscode.Uri).fsPath;
4444
} else if (context && !!(context as BlockchainIdentifier).name) {
4545
// Activation was by right-click on an item in the Blockchain explorer
46-
commandArguments.blockchainIdentifier = context as BlockchainIdentifier;
46+
commandArguments.blockchainIdentifier =
47+
context as BlockchainIdentifier;
4748
} else if (context) {
4849
// Activation by command URI containing query string parameters
4950
commandArguments = await sanitizeCommandArguments(context);
@@ -365,4 +366,5 @@ export async function activate(context: vscode.ExtensionContext) {
365366

366367
export function deactivate() {
367368
Log.log(LOG_PREFIX, "Deactivating extension...");
369+
Log.close();
368370
}

src/extension/neoExpress/neoExpress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as childProcess from "child_process";
22
import * as vscode from "vscode";
33
import * as which from "which";
44

5-
import Log from "../../shared/log";
5+
import Log from "../util/log";
66
import NeoExpressTerminal from "./neoExpressTerminal";
77
import posixPath from "../util/posixPath";
88

0 commit comments

Comments
 (0)