1use crate::{endpoint::EndpointExt, EndpointSuper, LOGGER};
2
3pub struct LogEntry<'a, EP> {
5 pub time: chrono::DateTime<chrono::Utc>,
7 pub endpoint: &'a EP,
9 pub text: &'a str,
11}
12
13#[doc(hidden)]
14pub fn impl_log<EP: EndpointSuper + std::hash::Hash + 'static>(endpoint: EP, message: String) {
15 let output = endpoint.fmt_message(message);
16 let mut guard = LOGGER.lock().unwrap();
17 let logger = guard.as_mut().expect("Uninitialized logger. Did you forget to call `aether::init` or did you drop the `KeepAlive` object early?");
18 logger.log(endpoint.endpoint_hash(), output);
19}