Separate log level from debug level

This allows DEBUG_ASSERT to be left on while reducing the amount of log
noise during boot.

Also disable tracing the init system.

Bug: 184759599
Change-Id: Ibbbd1befea1b20f8888ab23ff08412e77dfe79d9
diff --git a/engine.mk b/engine.mk
index b5cb418..95d0a7b 100644
--- a/engine.mk
+++ b/engine.mk
@@ -48,6 +48,7 @@
 
 TEST_BUILD ?=
 DEBUG ?= 2
+LOGGING ?= $(DEBUG)
 
 BUILDDIR := $(BUILDROOT)/build-$(PROJECT)
 OUTBIN := $(BUILDDIR)/lk.bin
@@ -218,11 +219,9 @@
 	ARCH=\"$(ARCH)\" \
 	$(addsuffix =1,$(addprefix WITH_,$(ALLMODULES)))
 
-# debug build?
-ifneq ($(DEBUG),)
 GLOBAL_DEFINES += \
-	LK_DEBUGLEVEL=$(DEBUG)
-endif
+	LK_DEBUGLEVEL=$(DEBUG) \
+	LK_LOGLEVEL=$(LOGGING) \
 
 # test build?
 ifneq ($(TEST_BUILD),)
diff --git a/include/debug.h b/include/debug.h
index 0b780f9..125a258 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -65,7 +65,7 @@
     hexdump8_ex(ptr, len, (uint64_t)((addr_t)ptr));
 }
 
-#define dprintf(level, x...) do { if ((level) <= LK_DEBUGLEVEL) { printf(x); } } while (0)
+#define dprintf(level, x...) do { if ((level) <= LK_LOGLEVEL) { printf(x); } } while (0)
 
 /* spin the cpu for a period of (short) time */
 void spin(uint32_t usecs);
diff --git a/top/init.c b/top/init.c
index 44569d8..869f7af 100644
--- a/top/init.c
+++ b/top/init.c
@@ -35,7 +35,7 @@
 #include <trace.h>
 
 #define LOCAL_TRACE 0
-#define TRACE_INIT (LK_DEBUGLEVEL >= 2)
+#define TRACE_INIT 0
 #define TRACE_INIT_FLAGS (LK_INIT_FLAG_ALL_CPUS)
 #ifndef EARLIEST_TRACE_LEVEL
 #define EARLIEST_TRACE_LEVEL LK_INIT_LEVEL_TARGET_EARLY