[log] `target` not very useful in javascript logs
When using tauri-plugin-log, the target is not really accurate for javascript logs. It seems to always just result in the actual function in tauri-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)?
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()
I believe this is fixed in #2021, can you guys confirm if it's indeed working now?
Closing this as completed since I believe #2021 have fixed this and there're no more responses, feel free to re-open if you have any more problems though