iggy icon indicating copy to clipboard operation
iggy copied to clipboard

impl `Display` for `Partition`, `Segment`, `Stream`

Open hubcio opened this issue 1 year ago • 0 comments

So that there will no less info than currently.

This is already done for topic:

impl fmt::Display for Topic {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "ID: {}, ", self.topic_id)?;
        write!(f, "stream ID: {}, ", self.stream_id)?;
        write!(f, "name: {}, ", self.name)?;
        write!(f, "path: {}, ", self.path)?;
        write!(f, "partitions count: {:?}, ", self.partitions.len())?;
        write!(f, "message expiry (s): {:?}, ", self.message_expiry_secs)?;
        write!(f, "max topic size (B): {:?}, ", self.max_topic_size_bytes)?;
        write!(f, "replication factor: {}, ", self.replication_factor)
    }
}

and usage:

info!("Created topic {}", topic);
info!("Updated topic: {}", topic);
info!("Loading consumer groups for topic {} from disk...", topic);
info!("Loading topic {} from disk...", topic);
info!("Loaded topic {}", topic);
info!("Saved topic {}", topic);
info!("Deleting topic {}...", topic);

The aim of this task is to also use those calls whenever possible.

hubcio avatar Jan 05 '24 20:01 hubcio