mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 17:06:35 +03:00
Log messages in info!() if DCC_MIME_DEBUG is set
Using println!() leads to reordered output on terminal. Moreover, println!() prints to stdout which is not for logging.
This commit is contained in:
@@ -722,9 +722,11 @@ impl<'a> MimeFactory<'a> {
|
|||||||
));
|
));
|
||||||
|
|
||||||
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
||||||
info!(context, "mimefactory: outgoing message mime:");
|
info!(
|
||||||
let raw_message = message.clone().build().as_string();
|
context,
|
||||||
println!("{}", raw_message);
|
"mimefactory: unencrypted message mime-body:\n{}",
|
||||||
|
message.clone().build().as_string(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let encrypted = encrypt_helper
|
let encrypted = encrypt_helper
|
||||||
@@ -782,6 +784,14 @@ impl<'a> MimeFactory<'a> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.fold(outer_message, |message, header| message.header(header));
|
.fold(outer_message, |message, header| message.header(header));
|
||||||
|
|
||||||
|
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
||||||
|
info!(
|
||||||
|
context,
|
||||||
|
"mimefactory: outgoing message mime-body:\n{}",
|
||||||
|
outer_message.clone().build().as_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let MimeFactory {
|
let MimeFactory {
|
||||||
last_added_location_id,
|
last_added_location_id,
|
||||||
..
|
..
|
||||||
|
|||||||
@@ -244,8 +244,11 @@ impl MimeMessage {
|
|||||||
mail_raw = raw;
|
mail_raw = raw;
|
||||||
let decrypted_mail = mailparse::parse_mail(&mail_raw)?;
|
let decrypted_mail = mailparse::parse_mail(&mail_raw)?;
|
||||||
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
||||||
info!(context, "decrypted message mime-body:");
|
info!(
|
||||||
println!("{}", String::from_utf8_lossy(&mail_raw));
|
context,
|
||||||
|
"decrypted message mime-body:\n{}",
|
||||||
|
String::from_utf8_lossy(&mail_raw),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
(Ok(decrypted_mail), signatures, true)
|
(Ok(decrypted_mail), signatures, true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,12 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
) -> Result<Option<ReceivedMsg>> {
|
) -> Result<Option<ReceivedMsg>> {
|
||||||
info!(context, "Receiving message, seen={}...", seen);
|
info!(context, "Receiving message, seen={}...", seen);
|
||||||
|
|
||||||
if std::env::var(crate::DCC_MIME_DEBUG).unwrap_or_default() == "2" {
|
if std::env::var(crate::DCC_MIME_DEBUG).is_ok() {
|
||||||
info!(context, "receive_imf: incoming message mime-body:");
|
info!(
|
||||||
println!("{}", String::from_utf8_lossy(imf_raw));
|
context,
|
||||||
|
"receive_imf: incoming message mime-body:\n{}",
|
||||||
|
String::from_utf8_lossy(imf_raw),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut mime_parser =
|
let mut mime_parser =
|
||||||
|
|||||||
Reference in New Issue
Block a user