Put invoke timing logs behind VITE_LOG_INVOKE_TIMINGS

They flooded the dev console and test logs; perf work can turn them on.
This commit is contained in:
Rūdolfs Ošiņš
2026-10-01 18:16:29 +02:00
parent c01f1a9a8a
commit 0172253b4d
4 changed files with 17 additions and 1 deletions
+3
View File
@@ -28,6 +28,9 @@ npm run tauri dev # full Tauri dev build with hot reload
npm run start:http # Vite dev server backed by test-http-api (no Tauri runtime)
```
Set `VITE_LOG_INVOKE_TIMINGS=true` to log each command's duration
(`[invoke] <command> <ms>ms`) to the browser console. It is off by default.
### Checks and linting (tsc, svelte-check, eslint, prettier)
```sh
+8
View File
@@ -40,6 +40,14 @@ To start the app in development mode with hot reload:
npm run dev
```
To log how long every backend command takes, for performance work, set
`VITE_LOG_INVOKE_TIMINGS=true`. Each call then prints `[invoke] <command> <ms>ms`
to the browser console (visible at debug level):
```
VITE_LOG_INVOKE_TIMINGS=true npm run dev
```
## Releasing
Releases are driven by an interactive, phased script. Start one with:
+1 -1
View File
@@ -16,7 +16,7 @@ export async function invoke<T = null>(
args?: tauri.InvokeArgs,
options?: tauri.InvokeOptions,
): Promise<T> {
if (import.meta.env.DEV) {
if (import.meta.env.VITE_LOG_INVOKE_TIMINGS === "true") {
const start = performance.now();
try {
return await withTestBackend<T>(tauri.invoke, cmd, args, options);
+5
View File
@@ -1,2 +1,7 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />
interface ImportMetaEnv {
// eslint-disable-next-line @typescript-eslint/naming-convention
readonly VITE_LOG_INVOKE_TIMINGS?: string;
}