Browse Source

adds short_uuid fn to root

master
Jonathan Strong 6 years ago
parent
commit
e11ea9ed6a
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/lib.rs

+ 8
- 1
src/lib.rs View File

@@ -37,6 +37,7 @@ use sloggers::types::TimeZone;
#[allow(unused_imports)] #[allow(unused_imports)]
use sloggers::file::FileLoggerBuilder; use sloggers::file::FileLoggerBuilder;
use slog::Drain; use slog::Drain;
use uuid::Uuid;


pub mod influx; pub mod influx;
#[cfg(feature = "warnings")] #[cfg(feature = "warnings")]
@@ -96,4 +97,10 @@ pub fn dur_nanos(d: ::std::time::Duration) -> i64 {
(d.as_secs() * 1_000_000_000_u64 + (d.subsec_nanos() as u64)) as i64 (d.as_secs() * 1_000_000_000_u64 + (d.subsec_nanos() as u64)) as i64
} }



pub fn short_uuid(id: &Uuid) -> String {
if cfg!(feature = "disable-short-uuid") {
id.to_string()
} else {
format!("{}", &id.to_string()[..8])
}
}

Loading…
Cancel
Save