Skip to content

Console

Screenshot of the calls tab showing lines of log messages

The console tab is a rather simple output of all emitted log messages aggregated from your code and all your code’s dependencies. Any events you emit using the log or tracing crates will be captured here.

Log messages have associated Log Levels (Trace, Debug, Info, Warn, Error) and messages in the console will be color highlighted accordingly. You also have the option at the top of the console to filter by level, e.g. you can exclude the very verbose Trace and Debug messages.

Each log message will also include the source code location that the message originated from whenever available. A message might not always have location information available.

Setup using Rusts cfg macros

In the following snippet we use Rusts cfg macros to conditionally enable devtools in debug builds and tauri-plugin-log when building with release optimizations.

fn main() {
#[cfg(debug_assertions)]
let devtools = devtools::init(); // initialize the plugin as early as possible
let mut builder = tauri::Builder::default();
#[cfg(debug_assertions)]
{
builder = builder.plugin(devtools); // then register it with Tauri
}
#[cfg(not(debug_assertions))]
{
builder = builder.plugin(tauri_plugin_log::Builder::default().targets([LogTarget::LogDir]).build());
}
builder.run(tauri::generate_context!("./tauri.conf.json"))
.expect("error while running tauri application");
}