Open harrismcc opened 3 months ago
Technically there's a second parameter options
to all log fns exposed by tauri-plugin-log
:
https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/log/guest-js/index.ts#L8-L12
export interface LogOptions {
file?: string;
line?: number;
keyValues?: Record<string, string | undefined>;
}
But my experience has been that none of those parameters work 😞. They don't show up on the Rust side.
Would be a great improvement to have file
and line
map to the actual call site.
Yes, totally agree with this issue. I'm currently getting this, which is not useful:
[2024-08-10][10:21:30][log@http://localhost:1420/node_modules/.vite/deps/@tauri-apps_plugin-log.js:18:20][DEBUG] Returning the ratio
Same here useless log for typescript:
I prefer this until this issue will fixed:
I'm using record.file() and record.line()
When using
tauri-plugin-log
, thetarget
is not really accurate for javascript logs. It seems to always just result in the actual function intauri-plugin-log
that generates the log, not the place where I called the log function.For example, using
info("this is a test info log")
in my javascript code will result in a log line like:[2024-06-11][18:22:35][INFO][log@http://localhost:1420/node_modules/.vite/deps/tauri-plugin-log-api.js:70:20] this is a test info log
Is there a way around this? Is there some configuration I'm missing on the javascript side of things (the rust locations seem to work)?