Skip to content

Commit

Permalink
feat: make the log output less spammy
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Sep 11, 2024
1 parent 7437b84 commit d0ec4ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions server/src/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async fn get_locations(
}
}

#[tracing::instrument(skip(pool),ret(level = tracing::Level::TRACE))]
#[tracing::instrument(skip(pool))]
async fn get_from_db(
pool: &PgPool,
locations: &[CalendarLocation],
Expand All @@ -130,7 +130,7 @@ async fn get_from_db(
location.key.clone(),
LocationEvents {
location: location.clone(),
events,
events: events.into(),
},
);
}
Expand Down
22 changes: 18 additions & 4 deletions server/src/calendar/models.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::fmt::{Display, Debug, Formatter};
use crate::limited::vec::LimitedVec;

#[derive(Serialize, Deserialize, Clone, Debug)]
#[derive(Serialize, Deserialize, Clone)]
pub(super) struct CalendarLocation {
pub key: String,
pub name: String,
Expand All @@ -11,9 +12,22 @@ pub(super) struct CalendarLocation {
pub type_common_name: String,
pub r#type: String,
}
#[derive(Serialize, Deserialize, Clone, Debug)]

impl Debug for CalendarLocation{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut base= f.debug_struct("CalendarLocation");
base.field("building", &self.key)
.field("name", &self.name);
if let Some(from)=&self.last_calendar_scrape_at{
base.field("from", from);
}
base.finish()
}
}

#[derive(Serialize, Deserialize, Clone)]
pub(super) struct LocationEvents {
pub(super) events: Vec<Event>,
pub(super) events: LimitedVec<Event>,
pub(super) location: CalendarLocation,
}

Expand Down
8 changes: 4 additions & 4 deletions server/src/search/search_executor/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ pub(super) struct MSHit {
}
impl Debug for MSHit {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut base = f.debug_struct("MSHit");
base.field("id", &self.id);
base.field("name", &self.name);
base.finish()
f.debug_struct("MSHit")
.field("id", &self.id)
.field("name", &self.name)
.finish()
}
}

Expand Down

0 comments on commit d0ec4ee

Please sign in to comment.