Skip to content

Commit

Permalink
fix crabnebula-devtools code sample (#3154)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasfvitor authored Feb 3, 2025
1 parent f258692 commit a7e0598
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Binary file added src/assets/develop/Debug/crabnebula-devtools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions src/content/docs/develop/Debug/crabnebula-devtools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sidebar:
variant: tip
---

import { Image } from 'astro:assets';
import devToolsPrint from '@assets/develop/Debug/crabnebula-devtools.png';

[CrabNebula](https://crabnebula.dev/) provides a free [DevTools](https://crabnebula.dev/devtools/) application for Tauri as part of its partnership with the Tauri project. This application allows you to instrument your Tauri app by capturing its embedded assets, Tauri configuration file, logs and spans and providing a web frontend to seamlessly visualize data in real time.

With the CrabNebula DevTools you can inspect your app's log events (including logs from dependencies), track down the performance of your command calls and overall Tauri API usage, with a special interface for Tauri events and commands, including payload, responses and inner logs and execution spans.
Expand All @@ -20,19 +23,27 @@ And initialize the plugin as soon as possible in your main function:

```rust
fn main() {
#[cfg(debug_assertions)]
let devtools = tauri_plugin_devtools::init(); // initialize the plugin as early as possible
// This should be called as early in the execution of the app as possible
#[cfg(debug_assertions)] // only enable instrumentation in development builds
let devtools = tauri_plugin_devtools::init();

let mut builder = tauri::Builder::default();

#[cfg(debug_assertions)]
builder = builder.plugin(devtools); // then register it with Tauri
{
builder = builder.plugin(devtools);
}

builder.run(tauri::generate_context!())
builder
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```

And then run your app as usual, if everything is set up correctly devtools will print the following message:

<Image src={devToolsPrint} alt="DevTools message on terminal" />

:::note
In this case we only initialize the devtools plugin for debug applications, which is recommended.
:::
Expand Down

0 comments on commit a7e0598

Please sign in to comment.