Jelajahi Sumber

Use `tracing::warn!` instead of `error!` when assets not being preloaded (#2251)

* Use `tracing::warn!` instead of `error!` when assets not being preloaded

Currently, it emits a `tracing::error` when assets not being preloaded if the dioxus CLI was not used to build the application. It should be a warning since `cargo` can also build the application successfully.

* add more details to desktop preload warning

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Zan Pan 1 tahun lalu
induk
melakukan
fcbebbbf14
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      packages/desktop/src/protocol.rs

+ 1 - 1
packages/desktop/src/protocol.rs

@@ -86,7 +86,7 @@ fn assets_head() -> Option<String> {
         match std::fs::read_to_string(&head) {
             Ok(s) => Some(s),
             Err(err) => {
-                tracing::error!("Failed to read {head:?}: {err}");
+                tracing::warn!("Assets built with manganis cannot be preloaded (failed to read {head:?}). This warning may occur when you build a desktop application without the dioxus CLI. If you do not use manganis, you can ignore this warning: {err}.");
                 None
             }
         }