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 Apr 21, 2017
1 parent 4195412 commit c17ea45
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 @@ -243,6 +243,8 @@ 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] = ["", "❤️", "💛", "💙",
"💚", "💜"];

/// An enum representing the available verbosity levels of the logging framework
///
Expand Down Expand Up @@ -370,6 +372,11 @@ impl LogLevel {
}
}

/// 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() -> LogLevel {
Expand Down

0 comments on commit c17ea45

Please sign in to comment.