add spantrace debug logs

This commit is contained in:
Lucy Cifferello
2021-10-12 17:04:36 -06:00
committed by Aiden McClelland
parent 0a4f60ae26
commit 7adb66cf4c
10 changed files with 27 additions and 6 deletions

View File

@@ -181,10 +181,14 @@ async fn run_script_if_exists<P: AsRef<Path>>(path: P) {
match Command::new("/bin/bash").arg(script).spawn() { match Command::new("/bin/bash").arg(script).spawn() {
Ok(mut c) => { Ok(mut c) => {
if let Err(e) = c.wait().await { if let Err(e) = c.wait().await {
tracing::error!("Error Running {}: {}", script.display(), e) tracing::error!("Error Running {}: {}", script.display(), e);
tracing::debug!("{:?}", e);
} }
} }
Err(e) => tracing::error!("Error Running {}: {}", script.display(), e), Err(e) => {
tracing::error!("Error Running {}: {}", script.display(), e);
tracing::debug!("{:?}", e);
}
} }
} }
} }

View File

@@ -28,6 +28,7 @@ fn status_fn(_: i32) -> StatusCode {
fn err_to_500(e: Error) -> Response<Body> { fn err_to_500(e: Error) -> Response<Body> {
tracing::error!("{}", e); tracing::error!("{}", e);
tracing::debug!("{:?}", e);
Response::builder() Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR) .status(StatusCode::INTERNAL_SERVER_ERROR)
.body(Body::empty()) .body(Body::empty())

View File

@@ -157,7 +157,10 @@ pub async fn subscribe(ctx: RpcContext, req: Request<Body>) -> Result<Response<B
tokio::task::spawn(async move { tokio::task::spawn(async move {
match ws_handler(ctx, ws_fut).await { match ws_handler(ctx, ws_fut).await {
Ok(()) => (), Ok(()) => (),
Err(e) => tracing::error!("WebSocket Closed: {}", e), Err(e) => {
tracing::error!("WebSocket Closed: {}", e);
tracing::debug!("{:?}", e);
}
} }
}); });
} }

View File

@@ -116,6 +116,7 @@ pub async fn install(
tokio::spawn(async move { tokio::spawn(async move {
if let Err(e) = download_install_s9pk(&ctx, &man, s9pk).await { if let Err(e) = download_install_s9pk(&ctx, &man, s9pk).await {
tracing::error!("Install of {}@{} Failed: {}", man.id, man.version, e); tracing::error!("Install of {}@{} Failed: {}", man.id, man.version, e);
tracing::debug!("{:?}", e);
} }
}); });
@@ -276,6 +277,7 @@ pub async fn download_install_s9pk(
version, version,
e e
); );
tracing::debug!("{:?}", e);
let mut broken = crate::db::DatabaseModel::new() let mut broken = crate::db::DatabaseModel::new()
.broken_packages() .broken_packages()
.get_mut(&mut tx) .get_mut(&mut tx)

View File

@@ -91,6 +91,7 @@ impl ManagerMap {
if let Some(man) = self.0.write().await.remove(id) { if let Some(man) = self.0.write().await.remove(id) {
if let Err(e) = man.exit().await { if let Err(e) = man.exit().await {
tracing::error!("Error shutting down manager: {}", e); tracing::error!("Error shutting down manager: {}", e);
tracing::debug!("{:?}", e);
} }
} }
} }
@@ -325,13 +326,15 @@ impl Manager {
Err(e) => { Err(e) => {
// TODO for code review: Do we return this error or just log it? // TODO for code review: Do we return this error or just log it?
tracing::error!("Failed to issue notification: {}", e); tracing::error!("Failed to issue notification: {}", e);
tracing::debug!("{:?}", e);
} }
Ok(()) => {} Ok(()) => {}
} }
tracing::error!("service crashed: {}: {}", e.0, e.1) tracing::error!("service crashed: {}: {}", e.0, e.1);
} }
Err(e) => { Err(e) => {
tracing::error!("failed to start service: {}", e) tracing::error!("failed to start service: {}", e);
tracing::debug!("{:?}", e);
} }
} }
} }

View File

@@ -389,6 +389,7 @@ pub async fn tor_health_check(client: &Client, tor_controller: &TorController) {
} }
Err(e) => { Err(e) => {
tracing::error!("Unable to restart tor: {}", e); tracing::error!("Unable to restart tor: {}", e);
tracing::debug!("{:?}", e);
} }
} }
} }

View File

@@ -68,6 +68,7 @@ pub async fn add(
match add_procedure(wpa_supplicant, &ssid, &password, priority, connect).await { match add_procedure(wpa_supplicant, &ssid, &password, priority, connect).await {
Err(e) => { Err(e) => {
tracing::error!("Failed to add new WiFi network '{}': {}", ssid, e); tracing::error!("Failed to add new WiFi network '{}': {}", ssid, e);
tracing::debug!("{:?}", e);
} }
Ok(_) => {} Ok(_) => {}
} }

View File

@@ -183,6 +183,7 @@ pub async fn execute_inner(
if let Err(e) = recover(ctx.clone(), guid, recovery_drive, recovery_password).await { if let Err(e) = recover(ctx.clone(), guid, recovery_drive, recovery_password).await {
BEETHOVEN.play().await.unwrap_or_default(); // ignore error in playing the song BEETHOVEN.play().await.unwrap_or_default(); // ignore error in playing the song
tracing::error!("Error recovering drive!: {}", e); tracing::error!("Error recovering drive!: {}", e);
tracing::debug!("{:?}", e);
*ctx.recovery_status.write().await = Some(Err(e.into())); *ctx.recovery_status.write().await = Some(Err(e.into()));
} }
}); });

View File

@@ -34,6 +34,7 @@ impl Shutdown {
.await .await
{ {
tracing::error!("Error Stopping Journald: {}", e); tracing::error!("Error Stopping Journald: {}", e);
tracing::debug!("{:?}", e);
} }
if let Err(e) = Command::new("systemctl") if let Err(e) = Command::new("systemctl")
.arg("stop") .arg("stop")
@@ -42,12 +43,15 @@ impl Shutdown {
.await .await
{ {
tracing::error!("Error Stopping Docker: {}", e); tracing::error!("Error Stopping Docker: {}", e);
tracing::debug!("{:?}", e);
} }
if let Err(e) = export(&*self.zfs_pool).await { if let Err(e) = export(&*self.zfs_pool).await {
tracing::error!("Error Exporting ZFS Pool: {}", e); tracing::error!("Error Exporting ZFS Pool: {}", e);
tracing::debug!("{:?}", e);
} }
if let Err(e) = MARIO_DEATH.play().await { if let Err(e) = MARIO_DEATH.play().await {
tracing::error!("Error Playing Shutdown Song: {}", e); tracing::error!("Error Playing Shutdown Song: {}", e);
tracing::debug!("{:?}", e);
} }
}); });
if self.restart { if self.restart {

View File

@@ -138,7 +138,8 @@ impl Drop for SoundInterface {
let guard = self.0.take(); let guard = self.0.take();
tokio::spawn(async move { tokio::spawn(async move {
if let Err(e) = tokio::fs::write(&*UNEXPORT_FILE, "0").await { if let Err(e) = tokio::fs::write(&*UNEXPORT_FILE, "0").await {
tracing::error!("Failed to Unexport Sound Interface: {}", e) tracing::error!("Failed to Unexport Sound Interface: {}", e);
tracing::debug!("{:?}", e);
} }
if let Some(mut guard) = guard { if let Some(mut guard) = guard {
if let Some(lock) = guard.take() { if let Some(lock) = guard.take() {