Skip to content

Commit 2af218a

Browse files
authored
[forgive][ez] Tweak logging (facebook#33011)
Just some tweaks --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33011). * facebook#33012 * __->__ facebook#33011 * facebook#33010
1 parent b06bb35 commit 2af218a

File tree

1 file changed

+6
-3
lines changed
  • compiler/packages/react-forgive/server/src

1 file changed

+6
-3
lines changed

compiler/packages/react-forgive/server/src/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ connection.onInitialized(() => {
132132
});
133133

134134
documents.onDidChangeContent(async event => {
135-
connection.console.info(`Changed: ${event.document.uri}`);
135+
connection.console.info(`Compiling: ${event.document.uri}`);
136136
resetState();
137137
if (SUPPORTED_LANGUAGE_IDS.has(event.document.languageId)) {
138138
const text = event.document.getText();
@@ -143,8 +143,11 @@ documents.onDidChangeContent(async event => {
143143
options: compilerOptions,
144144
});
145145
} catch (err) {
146+
connection.console.error('Failed to compile');
146147
if (err instanceof Error) {
147-
connection.console.error(err.stack ?? '');
148+
connection.console.error(err.stack ?? err.message);
149+
} else {
150+
connection.console.error(JSON.stringify(err, null, 2));
148151
}
149152
}
150153
}
@@ -192,7 +195,6 @@ connection.onCodeLensResolve(lens => {
192195
});
193196

194197
connection.onCodeAction(params => {
195-
connection.console.log('onCodeAction');
196198
const codeActions: Array<CodeAction> = [];
197199
for (const codeActionEvent of codeActionEvents) {
198200
if (
@@ -242,6 +244,7 @@ connection.onRequest(AutoDepsDecorationsRequest.type, async params => {
242244
});
243245

244246
function resetState() {
247+
connection.console.debug('Clearing state');
245248
compiledFns.clear();
246249
autoDepsDecorations = [];
247250
codeActionEvents = [];

0 commit comments

Comments
 (0)