aboutsummaryrefslogtreecommitdiff
path: root/src/proxy_config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-08 11:24:25 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-08 11:24:25 +0100
commitd7f3c13fa409ef2ee1ee78c18aae47e57383bec0 (patch)
tree427ceaca57f2038a4f46881b115624e72c7e3e14 /src/proxy_config.rs
parent098a6cf2cdb9b0370ab7358b005f731b65e9981c (diff)
downloadtricot-d7f3c13fa409ef2ee1ee78c18aae47e57383bec0.tar.gz
tricot-d7f3c13fa409ef2ee1ee78c18aae47e57383bec0.zip
Logging output improvements
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r--src/proxy_config.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs
index 9092b59..2807a3b 100644
--- a/src/proxy_config.rs
+++ b/src/proxy_config.rs
@@ -53,6 +53,22 @@ pub struct ProxyEntry {
pub calls: atomic::AtomicU64,
}
+impl std::fmt::Display for ProxyEntry {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{} ", self.target_addr)?;
+ match &self.host {
+ HostDescription::Hostname(h) => write!(f, "{}", h)?,
+ HostDescription::Pattern(p) => write!(f, "Pattern('{}')", p.as_str())?,
+ }
+ write!(f, "{} {}", self.path_prefix.as_ref().unwrap_or(&String::new()), self.priority)?;
+ if !self.add_headers.is_empty() {
+ write!(f, "+Headers: {:?}", self.add_headers)?;
+ }
+ Ok(())
+ }
+
+}
+
#[derive(Debug)]
pub struct ProxyConfig {
pub entries: Vec<ProxyEntry>,