Merge pull request #1588 from LemmyNet/improved-logging

Improved logging
This commit is contained in:
Dessalines 2021-04-21 10:34:47 -04:00 committed by GitHub
commit 9dc5605663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 25 deletions

View 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:

View 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)
}

View 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!())?;

View 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();

View 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:

View 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:

View 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: