From 0e04e67f6e6280f5b5f4846100920654c4b5154c Mon Sep 17 00:00:00 2001 From: projectmoon Date: Tue, 10 Nov 2020 20:35:27 +0000 Subject: [PATCH] Log debug instead of trace for timestamp index inserts. --- src/db/rooms.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/db/rooms.rs b/src/db/rooms.rs index d86e8e5..02a80ea 100644 --- a/src/db/rooms.rs +++ b/src/db/rooms.rs @@ -1,7 +1,7 @@ use crate::db::errors::DataError; use crate::db::schema::convert_u64; use byteorder::BigEndian; -use log::{debug, error, log_enabled, trace}; +use log::{debug, error, log_enabled}; use sled::transaction::TransactionalTree; use sled::Transactional; use sled::{CompareAndSwapError, Tree}; @@ -134,14 +134,12 @@ mod timestamp_index { ) -> Result<(), DataError> { let parts: Vec<&[u8]> = key.split(|&b| b == 0xff).collect(); if let [room_id, event_id] = parts[..] { - let event_id = str::from_utf8(event_id)?; - debug!("Adding event ID {} to timestamp index", event_id); - let mut ts_key = room_id.to_vec(); ts_key.push(0xff); ts_key.extend_from_slice(×tamp_bytes); - trace_index_record(room_id, event_id, ×tamp_bytes); + log_index_record(room_id, event_id, ×tamp_bytes); + let event_id = str::from_utf8(event_id)?; hashset_tree::add_to_set(roomtimestamp_eventid, &ts_key, event_id.to_owned())?; Ok(()) } else { @@ -149,10 +147,10 @@ mod timestamp_index { } } - /// Log a trace message. - fn trace_index_record(room_id: &[u8], event_id: &[u8], timestamp: &[u8]) { - if log_enabled!(log::Level::Trace) { - trace!( + /// Log a debug message. + fn log_index_record(room_id: &[u8], event_id: &[u8], timestamp: &[u8]) { + if log_enabled!(log::Level::Debug) { + debug!( "Recording event {} | {} received at {} in timestamp index.", str::from_utf8(room_id).unwrap_or("[invalid room id]"), str::from_utf8(event_id).unwrap_or("[invalid event id]"),