]> Untitled Git - lemmy.git/commitdiff
Improved logging
authorFelix Ableitner <me@nutomic.com>
Wed, 21 Apr 2021 12:42:33 +0000 (14:42 +0200)
committerFelix Ableitner <me@nutomic.com>
Wed, 21 Apr 2021 12:45:10 +0000 (14:45 +0200)
ansible/templates/docker-compose.yml
crates/apub/src/fetcher/fetch.rs
crates/apub_receive/src/inbox/community_inbox.rs
crates/apub_receive/src/inbox/person_inbox.rs
docker/dev/docker-compose.yml
docker/federation/docker-compose.yml
docker/prod/docker-compose.yml

index b074d60fec0bdf2d30b90e41b87a600ce8d2acf2..412e59512710933e11edbe02aa29c0dfee4f78c8 100644 (file)
@@ -7,7 +7,7 @@ services:
       - "127.0.0.1:8536:8536"
     restart: always
     environment:
-      - RUST_LOG=error
+      - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_apub_receive=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
     volumes:
       - ./lemmy.hjson:/config/config.hjson:ro
     depends_on:
index 304d1cd1418462d4277eb48eff6cdef515c58b85..27ea0fca4d47832c855736266a92f027bd911f67 100644 (file)
@@ -1,6 +1,7 @@
 use crate::{check_is_apub_id_valid, APUB_JSON_CONTENT_TYPE};
 use anyhow::anyhow;
 use lemmy_utils::{request::retry, LemmyError};
+use log::info;
 use reqwest::{Client, StatusCode};
 use serde::Deserialize;
 use std::time::Duration;
@@ -73,11 +74,14 @@ where
   .await?;
 
   if res.status() == StatusCode::GONE {
+    info!("Fetched remote object {} which was deleted", url);
     return Err(FetchError {
-      inner: anyhow!("Remote object {} was deleted", url),
+      inner: anyhow!("Fetched remote object {} which was deleted", url),
       status_code: Some(res.status()),
     });
   }
 
-  Ok(res.json().await?)
+  let object = res.json().await?;
+  info!("Fetched remote object {}", url);
+  Ok(object)
 }
index 84b0169917061d97b851687cbb8e9852677213ae..dfea860553810d91edd193b9e4659643da98a736 100644 (file)
@@ -96,13 +96,6 @@ pub async fn community_inbox(
   assert_activity_not_local(&activity)?;
   insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?;
 
-  info!(
-    "Community {} received activity {:?} from {}",
-    community.name,
-    &activity.id_unchecked(),
-    &actor.actor_id()
-  );
-
   community_receive_message(
     activity.clone(),
     community.clone(),
@@ -130,6 +123,16 @@ pub(crate) async fn community_receive_message(
   .await??;
   check_community_or_site_ban(&person, to_community.id, context.pool()).await?;
 
+  info!(
+    "Community {} received activity {} from {}",
+    to_community.name,
+    &activity
+      .id_unchecked()
+      .context(location_info!())?
+      .to_string(),
+    &person.actor_id().to_string()
+  );
+
   let any_base = activity.clone().into_any_base()?;
   let actor_url = actor.actor_id();
   let activity_kind = activity.kind().context(location_info!())?;
index 66b6c95ac03407a73723c90b0699629fa7e67991..65e912996558ed85961bfe026a4f0411a8b37b1b 100644 (file)
@@ -61,7 +61,7 @@ use lemmy_db_schema::source::{
 };
 use lemmy_utils::{location_info, LemmyError};
 use lemmy_websocket::LemmyContext;
-use log::debug;
+use log::info;
 use serde::{Deserialize, Serialize};
 use std::fmt::Debug;
 use strum_macros::EnumString;
@@ -115,13 +115,6 @@ pub async fn person_inbox(
   assert_activity_not_local(&activity)?;
   insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?;
 
-  debug!(
-    "Person {} received activity {:?} from {}",
-    person.name,
-    &activity.id_unchecked(),
-    &actor.actor_id()
-  );
-
   person_receive_message(
     activity.clone(),
     Some(person.clone()),
@@ -142,6 +135,15 @@ pub(crate) async fn person_receive_message(
 ) -> Result<HttpResponse, LemmyError> {
   is_for_person_inbox(context, &activity).await?;
 
+  info!(
+    "User received activity {:?} from {}",
+    &activity
+      .id_unchecked()
+      .context(location_info!())?
+      .to_string(),
+    &actor.actor_id().to_string()
+  );
+
   let any_base = activity.clone().into_any_base()?;
   let kind = activity.kind().context(location_info!())?;
   let actor_url = actor.actor_id();
index 7f8979fe68272e614d05b6c5077d8b7bbd502e66..3beecd8e5db64b39fce5a168f9c2340d31c52d4c 100644 (file)
@@ -8,7 +8,7 @@ services:
       - "8536:8536"
     restart: always
     environment:
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     volumes:
       - ../lemmy.hjson:/config/config.hjson
     depends_on: 
index c13c89ea4f32e714ac9231400e2a56f677ad629f..d2fe496d41ce269f7ffb6461650bb0307f31028c 100644 (file)
@@ -43,7 +43,7 @@ services:
     environment:
       - LEMMY_TEST_SEND_SYNC=1
       - RUST_BACKTRACE=1
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     depends_on:
       - postgres_alpha
     ports: 
@@ -72,7 +72,7 @@ services:
     environment:
       - LEMMY_TEST_SEND_SYNC=1
       - RUST_BACKTRACE=1
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     depends_on:
       - postgres_beta
     ports: 
@@ -101,7 +101,7 @@ services:
     environment:
       - LEMMY_TEST_SEND_SYNC=1
       - RUST_BACKTRACE=1
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     depends_on:
       - postgres_gamma
     ports: 
@@ -131,7 +131,7 @@ services:
     environment:
       - LEMMY_TEST_SEND_SYNC=1
       - RUST_BACKTRACE=1
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     depends_on:
       - postgres_delta
     ports: 
@@ -161,7 +161,7 @@ services:
     environment:
       - LEMMY_TEST_SEND_SYNC=1
       - RUST_BACKTRACE=1
-      - RUST_LOG=debug
+      - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
     depends_on:
       - postgres_epsilon
     ports: 
index 1024ecbc9997356fc8ed42f7e102e3857146f1d7..4cec4277ab4a535265dee08561d433e9f622fc4c 100644 (file)
@@ -17,7 +17,7 @@ services:
       - "127.0.0.1:8536:8536"
     restart: always
     environment:
-      - RUST_LOG=error
+      - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_apub_receive=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
     volumes:
       - ./lemmy.hjson:/config/config.hjson
     depends_on: