database
: Add debug logging
This commit is contained in:
parent
0c86515def
commit
86cdf48106
1 changed files with 5 additions and 0 deletions
|
@ -355,10 +355,13 @@ impl<DB> FromSql<diesel::sql_types::Text, DB> for Mime
|
||||||
String: FromSql<diesel::sql_types::Text, DB>,
|
String: FromSql<diesel::sql_types::Text, DB>,
|
||||||
{
|
{
|
||||||
fn from_sql(bytes: <DB as diesel::backend::Backend>::RawValue<'_>) -> diesel::deserialize::Result<Self> {
|
fn from_sql(bytes: <DB as diesel::backend::Backend>::RawValue<'_>) -> diesel::deserialize::Result<Self> {
|
||||||
|
log::trace!("Reading TEXT from the database...");
|
||||||
let s = <String as FromSql<diesel::sql_types::Text, DB>>::from_sql(bytes)?;
|
let s = <String as FromSql<diesel::sql_types::Text, DB>>::from_sql(bytes)?;
|
||||||
|
|
||||||
|
log::trace!("Attempting to parse as a media type: {s:?}");
|
||||||
let mime = mime::Mime::from_str(&s)?;
|
let mime = mime::Mime::from_str(&s)?;
|
||||||
|
|
||||||
|
log::trace!("Successfully parsed media type: {mime:?}");
|
||||||
Ok(Self(mime))
|
Ok(Self(mime))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,8 +373,10 @@ impl<DB> ToSql<diesel::sql_types::Text, DB> for Mime
|
||||||
str: ToSql<diesel::sql_types::Text, DB>,
|
str: ToSql<diesel::sql_types::Text, DB>,
|
||||||
{
|
{
|
||||||
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result {
|
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result {
|
||||||
|
log::trace!("Getting the essence of a media type to prepare for serialization...");
|
||||||
let mime = self.0.essence_str();
|
let mime = self.0.essence_str();
|
||||||
|
|
||||||
|
log::trace!("Serializing media type as TEXT: {mime:?}");
|
||||||
<str as ToSql<diesel::sql_types::Text, DB>>::to_sql(mime, out)
|
<str as ToSql<diesel::sql_types::Text, DB>>::to_sql(mime, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue