Skip to content

Commit

Permalink
add emoji representation of log level
Browse files Browse the repository at this point in the history
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
  • Loading branch information
king6cong committed Sep 8, 2017
1 parent 8af5f3c commit a365a82
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ const INITIALIZED: usize = 2;
static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT;

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

static SET_LOGGER_ERROR: &'static str = "attempted to set a logger after the logging system \
was already initialized";
Expand Down Expand Up @@ -435,6 +437,11 @@ impl Level {
}
}

/// Returns emoji representation of logging level
pub fn emoji(&self) -> &'static str {
LOG_LEVEL_EMOJIES[*self as usize]
}

/// Returns the most verbose logging level.
#[inline]
pub fn max() -> Level {
Expand Down

0 comments on commit a365a82

Please sign in to comment.