Skip to content

Commit

Permalink
feat: implements a common way to print session log of a request
Browse files Browse the repository at this point in the history
* This is implemented for pipe, tcp, rustls and kawa-h1 logs

Signed-off-by: Florentin Dubois <florentin.dubois@clever-cloud.com>
  • Loading branch information
FlorentinDUBOIS committed Jun 3, 2024
1 parent 99e90c1 commit 9b1827f
Show file tree
Hide file tree
Showing 5 changed files with 367 additions and 217 deletions.
16 changes: 15 additions & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ pub mod https;
use std::{
cell::RefCell,
collections::{BTreeMap, HashMap},
fmt,
fmt::{self, Display, Formatter},
net::SocketAddr,
rc::Rc,
str,
Expand Down Expand Up @@ -850,6 +850,20 @@ pub struct Readiness {
pub interest: Ready,
}

impl Display for Readiness {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let i = &mut [b'-'; 4];
let r = &mut [b'-'; 4];
let mixed = &mut [b'-'; 4];

display_ready(i, self.interest);
display_ready(r, self.event);
display_ready(mixed, self.interest & self.event);

write!(f, "I({:?})&R({:?})=M({:?})", String::from_utf8_lossy(i), String::from_utf8_lossy(r), String::from_utf8_lossy(mixed))
}
}

impl Default for Readiness {
fn default() -> Self {
Self::new()
Expand Down
Loading

0 comments on commit 9b1827f

Please sign in to comment.