Skip to content

Commit

Permalink
Trim down tracing output
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPickering committed Nov 16, 2023
1 parent 635261c commit 273b91a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/template/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Template {
/// returning the individual rendered chunks. This is useful in any
/// application where rendered chunks need to be handled differently from
/// raw chunks, e.g. in render previews.
#[instrument]
#[instrument(skip_all, fields(template = self.template))]
pub async fn render_chunks(
&self,
context: &TemplateContext,
Expand Down
31 changes: 30 additions & 1 deletion src/tui/view/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ pub struct DrawContext<'a, 'f> {
/// This is conceptually different from [Message] in that view messages never
/// queued, they are handled immediately. Maybe "message" is a misnomer here and
/// we should rename this?
#[derive(Debug)]
pub enum Event {
/// Sent when the view is first opened. If a component is created after the
/// initial view setup, it will *not* receive this message.
Expand Down Expand Up @@ -190,3 +189,33 @@ pub enum Update {
/// has a chance to respond to the entire event.
Propagate(Event),
}

/// Custom impl to prevent monster tracing messages
impl Debug for Event {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Init => write!(f, "Init"),
Self::Input { event, action } => f
.debug_struct("Input")
.field("event", event)
.field("action", action)
.finish(),
Self::HttpSendRequest => write!(f, "HttpSendRequest"),
Self::HttpSetState { recipe_id, state } => f
.debug_struct("HttpSetState")
.field("recipe_id", recipe_id)
.field("request_id", &state.id())
.finish(),
Self::ToggleFullscreen(arg0) => {
f.debug_tuple("ToggleFullscreen").field(arg0).finish()
}
Self::OpenModal { modal, priority } => f
.debug_struct("OpenModal")
.field("modal", modal)
.field("priority", priority)
.finish(),
Self::CloseModal => write!(f, "CloseModal"),
Self::Notify(arg0) => f.debug_tuple("Notify").field(arg0).finish(),
}
}
}

0 comments on commit 273b91a

Please sign in to comment.