PengZheng commented on code in PR #693:
URL: https://github.com/apache/celix/pull/693#discussion_r1413309858


##########
libs/framework/src/framework.c:
##########
@@ -2189,6 +2189,22 @@ void celix_framework_startBundleAsync(celix_framework_t 
*fw, long bndId) {
     celix_framework_startBundleInternal(fw, bndId, true);
 }
 
+static void celix_framework_printCelixErrForBundleEntry(celix_framework_t* 
framework,
+                                                        
celix_framework_bundle_entry_t* bndEntry) {
+    if (celix_err_getErrorCount() > 0) {
+        celix_framework_log(framework->logger, CELIX_LOG_LEVEL_WARNING, NULL, 
NULL, 0,
+               "Found unprocessed celix err messages for bundle %s 
[bndId=%li]. Unprocessed celix err messages:",
+               celix_bundle_getSymbolicName(bndEntry->bnd),
+               bndEntry->bndId);
+        int count = 1;
+        while (celix_err_getErrorCount() > 0) {
+            const char* msg = celix_err_popLastError();
+            celix_framework_log(framework->logger, CELIX_LOG_LEVEL_ERROR, 
NULL, NULL, 0,
+                                "Message nr %i: %s", count++, msg);
+        }

Review Comment:
   ```suggestion
           const char* msg = NULL;
           while ((msg = celix_err_popLastError())) {
               celix_framework_log(framework->logger, CELIX_LOG_LEVEL_ERROR, 
NULL, NULL, 0,
                                   "Message nr %i: %s", count++, msg);
           }
   ```
   
   Note that the current implementation of `celix_err_getErrorCount` is 
expensive.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to