pw_log_basic: Control emoji with PW_EMOJI

Makes the emoji log levels in pw_log_basic be controlled by the PW_EMOJI
environment variable.

Change-Id: I0bad0aee6b27d5d31d9c28137ac1a01ef9e8d640
diff --git a/pw_log_basic/BUILD.gn b/pw_log_basic/BUILD.gn
index 9e78058..d5a9dd8 100644
--- a/pw_log_basic/BUILD.gn
+++ b/pw_log_basic/BUILD.gn
@@ -43,6 +43,14 @@
     "$dir_pw_sys_io",
   ]
   public = [ "public/pw_log_basic/log_basic.h" ]
+
+  # Use emoji log levels if they've been enabled.
+  _use_emoji = getenv("PW_EMOJI")
+  defines = []
+  if (_use_emoji == "1") {
+    defines += [ "PW_EMOJI=1" ]
+  }
+
   sources = public + [ "log_basic.cc" ]
 }
 
diff --git a/pw_log_basic/log_basic.cc b/pw_log_basic/log_basic.cc
index e67d6d1..329f848 100644
--- a/pw_log_basic/log_basic.cc
+++ b/pw_log_basic/log_basic.cc
@@ -37,8 +37,11 @@
 #define RESET     "\033[0m"
 // clang-format on
 
+#ifndef PW_EMOJI
+#define PW_EMOJI 0
+#endif  // PW_EMOJI
+
 // TODO(pwbug/17): Expose these through the config system.
-#define PW_USE_EMOJIS 1
 #define PW_LOG_SHOW_FILENAME 0
 #define PW_LOG_SHOW_FUNCTION 0
 #define PW_LOG_SHOW_FLAG 0
@@ -49,7 +52,7 @@
 const char* LogLevelToLogLevelName(int level) {
   switch (level) {
     // clang-format off
-#if PW_USE_EMOJIS
+#if PW_EMOJI
     case PW_LOG_LEVEL_DEBUG    : return "👾" RESET;
     case PW_LOG_LEVEL_INFO     : return "ℹ️ " RESET;
     case PW_LOG_LEVEL_WARN     : return "⚠️ " RESET;
@@ -128,11 +131,11 @@
 
   // Column: Flag
 #if PW_LOG_SHOW_FLAG
-#if PW_USE_EMOJIS
+#if PW_EMOJI
   buffer << (flags ? "🚩" : "  ");
 #else
   buffer << (flags ? "*" : "|");
-#endif  // PW_USE_EMOJIS
+#endif  // PW_EMOJI
   buffer << " ";
 #else
   PW_UNUSED(flags);