Skip to content

Commit c17ea45

Browse files
committed
add emoji representation of log level
because we can't tweak Xcode 8 to use color in console emoji is a viable workaround, and log implementaion could use this. robbiehanson/XcodeColors#88
1 parent 4195412 commit c17ea45

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT;
243243

244244
static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO",
245245
"DEBUG", "TRACE"];
246+
static LOG_LEVEL_EMOJIES: [&'static str; 6] = ["", "❤️", "💛", "💙",
247+
"💚", "💜"];
246248

247249
/// An enum representing the available verbosity levels of the logging framework
248250
///
@@ -370,6 +372,11 @@ impl LogLevel {
370372
}
371373
}
372374

375+
/// Returns emoji representation of logging level
376+
pub fn emoji(&self) -> &'static str {
377+
LOG_LEVEL_EMOJIES[*self as usize]
378+
}
379+
373380
/// Returns the most verbose logging level.
374381
#[inline]
375382
pub fn max() -> LogLevel {

0 commit comments

Comments
 (0)