Switch to tracing for the cli (#2137)
* switch to tracing in the dioxus-cli * bump manganis * fix manganis features * only print processing assets if skip assets is disabled * switch all logs to tracing * switch to published version of manganis * undo all changes to cargo.toml * remove reference to log
This commit is contained in:
1 parent
da3b066934
commit
2ac4bdb673
19 files changed
+365
-416
No files matched your search
@@ -39,7 +39,7 @@ pub(crate) async fn startup_with_platform<P: Platform + Send + 'static>(
|
||||
FileMap::<HtmlCtx>::create(config.crate_dir.clone()).unwrap();
|
||||
|
||||
for err in errors {
|
||||
log::error!("{}", err);
|
||||
tracing::error!("{}", err);
|
||||
}
|
||||
|
||||
let file_map = Arc::new(Mutex::new(map));
|
||||
@@ -77,7 +77,7 @@ async fn serve<P: Platform + Send + 'static>(
|
||||
) -> Result<()> {
|
||||
let platform = RwLock::new(P::start(&config, serve)?);
|
||||
|
||||
log::info!("🚀 Starting development server...");
|
||||
tracing::info!("🚀 Starting development server...");
|
||||
|
||||
// We got to own watcher so that it exists for the duration of serve
|
||||
// Otherwise full reload won't work.
|
||||
@@ -258,7 +258,7 @@ impl DesktopPlatform {
|
||||
) -> Result<Self> {
|
||||
let (child, first_build_result) = start_desktop(config, serve.skip_assets, rust_flags)?;
|
||||
|
||||
log::info!("🚀 Starting development server...");
|
||||
tracing::info!("🚀 Starting development server...");
|
||||
|
||||
// Print serve info
|
||||
print_console_info(
|
||||
|
||||
@@ -89,7 +89,7 @@ async fn setup_file_watcher<F: Fn() -> Result<BuildResult> + Send + 'static>(
|
||||
let mode = notify::RecursiveMode::Recursive;
|
||||
|
||||
if let Err(err) = watcher.watch(path, mode) {
|
||||
log::warn!("Failed to watch path: {}", err);
|
||||
tracing::warn!("Failed to watch path: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ fn full_rebuild<F>(
|
||||
}
|
||||
Err(e) => {
|
||||
*last_update_time = chrono::Local::now().timestamp();
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,12 +195,12 @@ fn hotreload_files(
|
||||
|
||||
// If the file was not updated, we need to do a full rebuild
|
||||
Ok(UpdateResult::NeedsRebuild) => {
|
||||
log::trace!("Needs full rebuild because file changed: {:?}", path);
|
||||
tracing::trace!("Needs full rebuild because file changed: {:?}", path);
|
||||
*needs_full_rebuild = true;
|
||||
}
|
||||
|
||||
// Not necessarily a fatal error, but we should log it
|
||||
Err(err) => log::error!("{}", err),
|
||||
Err(err) => tracing::error!("{}", err),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ fn hotreload_files(
|
||||
} = FileMap::<HtmlCtx>::create(config.crate_dir.clone()).unwrap();
|
||||
|
||||
for err in errors {
|
||||
log::error!("{}", err);
|
||||
tracing::error!("{}", err);
|
||||
}
|
||||
|
||||
*rsx_file_map = new_file_map;
|
||||
@@ -250,7 +250,7 @@ fn hotreload_file(
|
||||
|
||||
// If the extension is a backup file, or a hidden file, ignore it completely (no rebuilds)
|
||||
if is_backup_file(path) {
|
||||
log::trace!("Ignoring backup file: {:?}", path);
|
||||
tracing::trace!("Ignoring backup file: {:?}", path);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ pub fn print_console_info(
|
||||
println!();
|
||||
|
||||
if options.warnings.is_empty() {
|
||||
log::info!("{}\n", "A perfect compilation!".green().bold());
|
||||
tracing::info!("{}\n", "A perfect compilation!".green().bold());
|
||||
} else {
|
||||
log::warn!(
|
||||
tracing::warn!(
|
||||
"{}",
|
||||
format!(
|
||||
"There were {} warning messages during the build. Run `cargo check` to see them.",
|
||||
|
||||
@@ -18,13 +18,13 @@ pub async fn hot_reload_handler(
|
||||
let err = hotreload_loop(socket, state).await;
|
||||
|
||||
if let Err(err) = err {
|
||||
log::error!("Hotreload receiver failed: {}", err);
|
||||
tracing::error!("Hotreload receiver failed: {}", err);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async fn hotreload_loop(mut socket: WebSocket, state: HotReloadState) -> anyhow::Result<()> {
|
||||
log::info!("🔥 Hot Reload WebSocket connected");
|
||||
tracing::info!("🔥 Hot Reload WebSocket connected");
|
||||
|
||||
// update any rsx calls that changed before the websocket connected.
|
||||
// These templates will be sent down immediately so the page is in sync with the hotreloaded version
|
||||
@@ -51,9 +51,9 @@ async fn hotreload_loop(mut socket: WebSocket, state: HotReloadState) -> anyhow:
|
||||
msg = _rx => msg,
|
||||
e = _socket => {
|
||||
if let Some(Err(e)) = e {
|
||||
log::info!("🔥 Hot Reload WebSocket Error: {}", e);
|
||||
tracing::info!("🔥 Hot Reload WebSocket Error: {}", e);
|
||||
} else {
|
||||
log::info!("🔥 Hot Reload WebSocket Closed");
|
||||
tracing::info!("🔥 Hot Reload WebSocket Closed");
|
||||
}
|
||||
break;
|
||||
},
|
||||
@@ -69,7 +69,7 @@ async fn hotreload_loop(mut socket: WebSocket, state: HotReloadState) -> anyhow:
|
||||
Message::Text(format!("reload-asset: {}", asset.display()))
|
||||
}
|
||||
HotReloadMsg::Shutdown => {
|
||||
log::info!("🔥 Hot Reload WebSocket shutting down");
|
||||
tracing::info!("🔥 Hot Reload WebSocket shutting down");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ pub async fn serve(
|
||||
// generate dev-index page
|
||||
Serve::regen_dev_page(&config, first_build_result.assets.as_ref())?;
|
||||
|
||||
log::info!("🚀 Starting development server...");
|
||||
tracing::info!("🚀 Starting development server...");
|
||||
|
||||
// WS Reload Watching
|
||||
let (reload_tx, _) = broadcast::channel(100);
|
||||
@@ -205,7 +205,7 @@ fn build_hotreload_filemap(config: &CrateConfig) -> HotReloadState {
|
||||
let FileMapBuildResult { map, errors } = FileMap::create(config.crate_dir.clone()).unwrap();
|
||||
|
||||
for err in errors {
|
||||
log::error!("{}", err);
|
||||
tracing::error!("{}", err);
|
||||
}
|
||||
|
||||
HotReloadState {
|
||||
|
||||
@@ -219,8 +219,8 @@ pub fn get_rustls_with_mkcert(web_config: &WebHttpsConfig) -> Result<(String, St
|
||||
match cmd {
|
||||
Err(e) => {
|
||||
match e.kind() {
|
||||
io::ErrorKind::NotFound => log::error!("mkcert is not installed. See https://github.com/FiloSottile/mkcert#installation for installation instructions."),
|
||||
e => log::error!("an error occured while generating mkcert certificates: {}", e.to_string()),
|
||||
io::ErrorKind::NotFound => tracing::error!("mkcert is not installed. See https://github.com/FiloSottile/mkcert#installation for installation instructions."),
|
||||
e => tracing::error!("an error occured while generating mkcert certificates: {}", e.to_string()),
|
||||
};
|
||||
return Err("failed to generate mkcert certificates".into());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user