fuzzysearch/fuzzysearch-common/src/lib.rs

36 lines
982 B
Rust
Raw Normal View History

#[cfg(feature = "queue")]
pub mod faktory;
2020-12-07 23:41:32 +00:00
pub mod types;
2021-02-21 06:26:29 +00:00
#[cfg(feature = "video")]
2020-12-07 23:41:32 +00:00
pub mod video;
#[cfg(feature = "trace")]
pub mod trace;
2021-08-22 05:37:36 +00:00
#[cfg(feature = "download")]
pub mod download;
2020-12-07 23:41:32 +00:00
/// Create an instance of img_hash with project defaults.
pub fn get_hasher() -> img_hash::Hasher<[u8; 8]> {
use img_hash::{HashAlg::Gradient, HasherConfig};
HasherConfig::with_bytes_type::<[u8; 8]>()
.hash_alg(Gradient)
.hash_size(8, 8)
.preproc_dct()
.to_hasher()
}
2021-04-22 01:46:10 +00:00
/// Initialize the logger. This should only be called by the running binary.
pub fn init_logger() {
if matches!(std::env::var("LOG_FMT").as_deref(), Ok("json")) {
tracing_subscriber::fmt::Subscriber::builder()
.json()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_timer(tracing_subscriber::fmt::time::ChronoUtc::rfc3339())
.init();
} else {
tracing_subscriber::fmt::init();
}
}