tauri-apps / tauri-apps/plugins-workspace

[log] File and line parameters are ignored

Open
#2,336 1 comment 2 reactions 0 assignees View on GitHub
plugin: log type: documentation type: feature request
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

I'm trying to manually specify file name and line number from Javascript using the log plugin. It seems however that both the file and line parameters are ignored, and the auto-generated path is always used instead:

```js
function foo() {
//This prints something like the following:
//[2025-01-19][21:00:00][webview:foo@http://localhost:1420/src/main.ts:4:3][INFO] bar
info("bar", { file: "baz.ts", line: 100 });
}
```

I'm aware I can write a custom formatter on the Rust side but that ends up being quite verbose, especially the date/time part.

I think it would be much nicer if the default formatter actually honored file name and line number when explicitly provided by the user, especially considering they're already part of the public API so it's pretty easy to assume they will actually show up in the logs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.