Add useful debug output for HTTP response and image cache.

This commit is contained in:
Josh Matthews 2019-10-04 13:10:08 -04:00
parent 734cf9e1b3
commit a241232c2b
4 changed files with 9 additions and 1 deletions

View file

@ -180,7 +180,8 @@ impl fmt::Display for ServoUrl {
impl fmt::Debug for ServoUrl {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if self.0.as_str().len() > 40 {
let hasher = DefaultHasher::new();
let mut hasher = DefaultHasher::new();
hasher.write(self.0.as_str().as_bytes());
let truncated: String = self.0.as_str().chars().take(40).collect();
let result = format!("{}... ({:x})", truncated, hasher.finish());
return result.fmt(formatter);