Revert "Revert "logging: add log level cache""

This reverts commit 7f1fb3ea817578f3f2f63e8065aa50f8355caa3b - slightly
amended with the new log_cache_enalbe() function.  The cache is hence
disabled by default, and applications can enable it, if they wish to
benefit from it.

Reason for the original revert was: some fallout expected due to log
manipulation in test code

Change-Id: I539872fc9e3c50b407e6bc388f1e091fa2c826c3
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 2a07422..678ae68 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -382,6 +382,10 @@
 	tgt->categories[category].enabled = 1;
 	tgt->categories[category].loglevel = level;
 
+#if !defined(EMBEDDED)
+	log_cache_update(category, 1, level);
+#endif
+
 	RET_WITH_UNLOCK(CMD_SUCCESS);
 }
 
@@ -406,6 +410,9 @@
 
 		cat->enabled = 1;
 		cat->loglevel = level;
+#if !defined(EMBEDDED)
+		log_cache_update(i, 1, level);
+#endif
 	}
 	RET_WITH_UNLOCK(CMD_SUCCESS);
 }