fix: use logging macros instead of emitting event directly, so that it is also logged by tracing (#7459)

The events are needed when you are not using chatmail core from rust, if
you use chatmail core from your rust bot or from tauri, then you likely
already use the rust logging/tracing ecosystem. So it makes sense to use
it instead of listening to the events and logging them yourself.

This pr fixes a few cases where the event was direclty emitted instead
of using the macro and thus was not also automatically logged via
tracing.
This commit is contained in:
Simon Laux
2025-12-09 13:17:31 +01:00
committed by GitHub
parent 98944efdb8
commit 95ed31391d
4 changed files with 26 additions and 5 deletions

View File

@@ -92,6 +92,11 @@ impl<S: SessionStream> AsyncRead for LoggingStream<S> {
"Read error on stream {peer_addr:?} after reading {} and writing {} bytes: {err}.",
this.metrics.total_read, this.metrics.total_written
);
tracing::event!(
::tracing::Level::WARN,
account_id = *this.account_id,
log_message
);
this.events.emit(Event {
id: *this.account_id,
typ: EventType::Warning(log_message),