This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/dfi-cleanup
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 3e61888bf48fc2684fc10fc388d200d4914acaf6
Author: PengZheng <[email protected]>
AuthorDate: Wed Dec 13 20:37:38 2023 +0800

    Replace dfi_log_util.h by celix_err.h.
---
 .../src/pubsub_json_serialization_provider.c       | 13 ----
 .../gtest/src/PubSubMatchingTestSuite.cpp          | 12 ----
 .../src/PubSubSerializationHandlerTestSuite.cc     | 12 ----
 .../src/pubsub_serialization_provider.c            | 16 -----
 libs/dfi/gtest/src/dyn_closure_tests.cpp           | 14 ----
 libs/dfi/gtest/src/dyn_function_tests.cpp          | 16 -----
 libs/dfi/gtest/src/dyn_interface_tests.cpp         | 15 -----
 libs/dfi/gtest/src/dyn_message_tests.cpp           | 14 ----
 libs/dfi/gtest/src/dyn_type_tests.cpp              | 13 ----
 libs/dfi/gtest/src/json_serializer_tests.cpp       | 15 -----
 libs/dfi/include/dfi_log_util.h                    | 78 ----------------------
 libs/dfi/include/dyn_common.h                      |  4 --
 libs/dfi/include/dyn_function.h                    |  3 -
 libs/dfi/include/dyn_interface.h                   |  3 -
 libs/dfi/include/dyn_message.h                     |  3 -
 libs/dfi/include/dyn_type.h                        |  4 --
 libs/dfi/include/json_rpc.h                        |  4 --
 libs/dfi/include/json_serializer.h                 |  4 --
 libs/dfi/src/dyn_common.c                          |  9 ++-
 libs/dfi/src/dyn_function.c                        | 15 ++---
 libs/dfi/src/dyn_interface.c                       | 20 +++---
 libs/dfi/src/dyn_message.c                         | 19 +++---
 libs/dfi/src/dyn_type.c                            | 62 +++++++++--------
 libs/dfi/src/dyn_type_common.c                     |  6 +-
 libs/dfi/src/dyn_type_common.h                     |  3 -
 libs/dfi/src/json_rpc.c                            | 24 +++----
 libs/dfi/src/json_serializer.c                     | 29 ++++----
 27 files changed, 88 insertions(+), 342 deletions(-)

diff --git 
a/bundles/pubsub/pubsub_serializer_json/src/pubsub_json_serialization_provider.c
 
b/bundles/pubsub/pubsub_serializer_json/src/pubsub_json_serialization_provider.c
index 0e787476..28a87f9f 100644
--- 
a/bundles/pubsub/pubsub_serializer_json/src/pubsub_json_serialization_provider.c
+++ 
b/bundles/pubsub/pubsub_serializer_json/src/pubsub_json_serialization_provider.c
@@ -29,18 +29,6 @@
 #include "celix_log_helper.h"
 #include "pubsub_message_serialization_service.h"
 
-static void dfi_log(void *handle, int level, const char *file, int line, const 
char *msg, ...) {
-    va_list ap;
-    celix_log_helper_t *log = handle;
-    char *logStr = NULL;
-    va_start(ap, msg);
-    vasprintf(&logStr, msg, ap);
-    va_end(ap);
-    celix_logHelper_log(log, level, "FILE:%s, LINE:%i, MSG:%s", file, line, 
logStr);
-    free(logStr);
-}
-
-
 static celix_status_t 
pubsub_jsonSerializationProvider_serialize(pubsub_serialization_entry_t* entry, 
const void* msg, struct iovec** output, size_t* outputIovLen) {
     celix_status_t status = CELIX_SUCCESS;
 
@@ -108,7 +96,6 @@ static void 
pubsub_jsonSerializationProvider_freeDeserializeMsg(pubsub_serializa
 
 pubsub_serialization_provider_t* 
pubsub_jsonSerializationProvider_create(celix_bundle_context_t* ctx)  {
     pubsub_serialization_provider_t* provider = 
pubsub_serializationProvider_create(ctx, "json", true, 0, 
pubsub_jsonSerializationProvider_serialize, 
pubsub_jsonSerializationProvider_freeSerializeMsg, 
pubsub_jsonSerializationProvider_deserialize, 
pubsub_jsonSerializationProvider_freeDeserializeMsg);
-    jsonSerializer_logSetup(dfi_log, 
pubsub_serializationProvider_getLogHelper(provider), 1);;
     return provider;
 }
 
diff --git a/bundles/pubsub/pubsub_utils/gtest/src/PubSubMatchingTestSuite.cpp 
b/bundles/pubsub/pubsub_utils/gtest/src/PubSubMatchingTestSuite.cpp
index a3b2bb82..1c0f421e 100644
--- a/bundles/pubsub/pubsub_utils/gtest/src/PubSubMatchingTestSuite.cpp
+++ b/bundles/pubsub/pubsub_utils/gtest/src/PubSubMatchingTestSuite.cpp
@@ -33,16 +33,6 @@
 #include "pubsub_endpoint.h"
 #include "pubsub_message_serialization_marker.h"
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-    va_list ap;
-    const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-    fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-    va_start(ap, msg);
-    vfprintf(stderr, msg, ap);
-    fprintf(stderr, "\n");
-    va_end(ap);
-}
-
 class PubSubMatchingTestSuite : public ::testing::Test {
 public:
     PubSubMatchingTestSuite() {
@@ -54,8 +44,6 @@ public:
         ctx = std::shared_ptr<celix_bundle_context_t>{ctxPtr, 
[](auto*){/*nop*/}};
 
         bndId = celix_bundleContext_installBundle(ctx.get(), MATCHING_BUNDLE, 
true);
-
-        dynMessage_logSetup(stdLog, NULL, 1);
     }
 
     ~PubSubMatchingTestSuite() override {
diff --git 
a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationHandlerTestSuite.cc 
b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationHandlerTestSuite.cc
index 2522fcbd..d8f466d1 100644
--- 
a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationHandlerTestSuite.cc
+++ 
b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationHandlerTestSuite.cc
@@ -30,16 +30,6 @@
 #include "celix_framework_factory.h"
 #include "celix_constants.h"
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-    va_list ap;
-    const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-    fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-    va_start(ap, msg);
-    vfprintf(stderr, msg, ap);
-    fprintf(stderr, "\n");
-    va_end(ap);
-}
-
 class PubSubSerializationHandlerTestSuite : public ::testing::Test {
 public:
     PubSubSerializationHandlerTestSuite() {
@@ -50,8 +40,6 @@ public:
         fw = std::shared_ptr<celix_framework_t>{fwPtr, [](auto* f) 
{celix_frameworkFactory_destroyFramework(f);}};
         ctx = std::shared_ptr<celix_bundle_context_t>{ctxPtr, 
[](auto*){/*nop*/}};
 
-        dynMessage_logSetup(stdLog, NULL, 1);
-
         msgSerSvc.handle = this;
         msgSerSvc.serialize = [](void* handle, const void*, struct iovec**, 
size_t*) -> celix_status_t {
             auto* suite = 
static_cast<PubSubSerializationHandlerTestSuite*>(handle);
diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c 
b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
index 3243fde6..b7d49178 100644
--- a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
+++ b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
@@ -81,18 +81,6 @@ struct pubsub_serialization_provider {
     celix_array_list_t *serializationSvcEntries; //key = 
pubsub_serialization_entry;
 };
 
-static void dfi_log(void *handle, int level, const char *file, int line, const 
char *msg, ...) {
-    (void)level;
-    va_list ap;
-    pubsub_serialization_provider_t *provider = handle;
-    char *logStr = NULL;
-    va_start(ap, msg);
-    vasprintf(&logStr, msg, ap);
-    va_end(ap);
-    celix_logHelper_log(provider->logHelper, CELIX_LOG_LEVEL_WARNING, 
"FILE:%s, LINE:%i, MSG:%s", file, line, logStr);
-    free(logStr);
-}
-
 static descriptor_type_e getDescriptorType(const char* filename) {
     if (strstr(filename, ".descriptor")) {
         return FIT_DESCRIPTOR;
@@ -610,10 +598,6 @@ pubsub_serialization_provider_t 
*pubsub_serializationProvider_create(
     provider->freeDeserializeMsg = freeDeserializeMsg;
     provider->logHelper = celix_logHelper_create(ctx, 
"celix_pubsub_serialization_provider");
 
-    dynFunction_logSetup(dfi_log, provider, 1);
-    dynType_logSetup(dfi_log, provider, 1);
-    dynCommon_logSetup(dfi_log, provider, 1);
-
     {
         //Start bundle tracker and register pubsub_message_serialization 
services
         celix_bundle_tracking_options_t opts = 
CELIX_EMPTY_BUNDLE_TRACKING_OPTIONS;
diff --git a/libs/dfi/gtest/src/dyn_closure_tests.cpp 
b/libs/dfi/gtest/src/dyn_closure_tests.cpp
index 819a4aa0..54bea43d 100644
--- a/libs/dfi/gtest/src/dyn_closure_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_closure_tests.cpp
@@ -35,16 +35,6 @@ extern "C" {
 
 static int g_count;
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-    va_list ap;
-    const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-    fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-    va_start(ap, msg);
-    vfprintf(stderr, msg, ap);
-    fprintf(stderr, "\n");
-    va_end(ap);
-}
-
 #define EXAMPLE1_DESCRIPTOR "example(III)I"
 static void example1_binding(void*, void* args[], void *out) {
     int32_t a = *((int32_t *)args[0]);
@@ -151,10 +141,6 @@ static void tests() {
 class DynClosureTests : public ::testing::Test {
 public:
     DynClosureTests() {
-        int lvl = 1;
-        dynFunction_logSetup(stdLog, NULL, lvl);
-        dynType_logSetup(stdLog, NULL, lvl);
-        dynCommon_logSetup(stdLog, NULL, lvl);
         g_count = 0;
     }
     ~DynClosureTests() override {
diff --git a/libs/dfi/gtest/src/dyn_function_tests.cpp 
b/libs/dfi/gtest/src/dyn_function_tests.cpp
index 7f0ba0dc..6164cbcc 100644
--- a/libs/dfi/gtest/src/dyn_function_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_function_tests.cpp
@@ -19,24 +19,12 @@
 
 #include "gtest/gtest.h"
 
-#include <stdarg.h>
 #include "dyn_example_functions.h"
 
 #include "dyn_common.h"
 #include "dyn_function.h"
 #include <ffi.h>
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-    va_list ap;
-    const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-    fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-    va_start(ap, msg);
-    vfprintf(stderr, msg, ap);
-    fprintf(stderr, "\n");
-    va_end(ap);
-}
-
-
 #define INVALID_FUNC_DESCRIPTOR "example$[D)V"//$ is an invalid symbol, 
missing (
 #define INVALID_FUNC_TYPE_DESCRIPTOR "example(H)A"//H and A are invalid types
 
@@ -44,10 +32,6 @@ static void stdLog(void*, int level, const char *file, int 
line, const char *msg
 class DynFunctionTests : public ::testing::Test {
 public:
     DynFunctionTests() {
-        int lvl = 1;
-        dynFunction_logSetup(stdLog, nullptr, lvl);
-        dynType_logSetup(stdLog, nullptr, lvl);
-        dynCommon_logSetup(stdLog, nullptr, lvl);
     }
     ~DynFunctionTests() override = default;
 
diff --git a/libs/dfi/gtest/src/dyn_interface_tests.cpp 
b/libs/dfi/gtest/src/dyn_interface_tests.cpp
index 2ddaa147..d7836cf4 100644
--- a/libs/dfi/gtest/src/dyn_interface_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_interface_tests.cpp
@@ -40,16 +40,6 @@ extern "C" {
 #include "fmemopen.h"
 #endif
 
-    static void stdLog(void*, int level, const char *file, int line, const 
char *msg, ...) {
-        va_list ap;
-        const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-        fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, 
line);
-        va_start(ap, msg);
-        vfprintf(stderr, msg, ap);
-        fprintf(stderr, "\n");
-        va_end(ap);
-    }
-
     static void checkInterfaceVersion(dyn_interface_type* dynIntf, const char* 
v) {
         int status;
 
@@ -197,11 +187,6 @@ extern "C" {
 class DynInterfaceTests : public ::testing::Test {
 public:
     DynInterfaceTests() {
-        int level = 1;
-        dynCommon_logSetup(stdLog, NULL, level);
-        dynType_logSetup(stdLog, NULL, level);
-        dynFunction_logSetup(stdLog, NULL, level);
-        dynInterface_logSetup(stdLog, NULL, level);
     }
     ~DynInterfaceTests() override {
     }
diff --git a/libs/dfi/gtest/src/dyn_message_tests.cpp 
b/libs/dfi/gtest/src/dyn_message_tests.cpp
index 4c1d242d..46d787ab 100644
--- a/libs/dfi/gtest/src/dyn_message_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_message_tests.cpp
@@ -40,16 +40,6 @@ extern "C" {
 #include "fmemopen.h"
 #endif
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-       va_list ap;
-       const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-       fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-       va_start(ap, msg);
-       vfprintf(stderr, msg, ap);
-       fprintf(stderr, "\n");
-       va_end(ap);
-}
-
 static void checkMessageVersion(dyn_message_type* dynMsg, const char* v){
        int status = 0;
 
@@ -229,10 +219,6 @@ static void msg_invalid(void) {
 class DynMessageTests : public ::testing::Test {
 public:
     DynMessageTests() {
-        int level = 1;
-        dynCommon_logSetup(stdLog, NULL, level);
-        dynType_logSetup(stdLog, NULL, level);
-        dynMessage_logSetup(stdLog, NULL, level);
     }
     ~DynMessageTests() override {
     }
diff --git a/libs/dfi/gtest/src/dyn_type_tests.cpp 
b/libs/dfi/gtest/src/dyn_type_tests.cpp
index 9cb23876..cfa01ee2 100644
--- a/libs/dfi/gtest/src/dyn_type_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_type_tests.cpp
@@ -20,22 +20,10 @@
 #include "gtest/gtest.h"
 
 extern "C" {
-    #include <stdarg.h>
-    
     #include "dyn_common.h"
     #include "dyn_type.h"
     #include "celix_err.h"
 
-       static void stdLog(void*, int level, const char *file, int line, const 
char *msg, ...) {
-           va_list ap;
-           const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", 
"DEBUG"};
-           fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, 
line);
-           va_start(ap, msg);
-           vfprintf(stderr, msg, ap);
-           fprintf(stderr, "\n");
-           va_end(ap);
-       }
-
     static void runTest(const char *descriptorStr, const char *exName) {
         dyn_type *type;
         type = NULL;
@@ -70,7 +58,6 @@ extern "C" {
 class DynTypeTests : public ::testing::Test {
 public:
     DynTypeTests() {
-        dynType_logSetup(stdLog, NULL, 1);
     }
     ~DynTypeTests() override {
     }
diff --git a/libs/dfi/gtest/src/json_serializer_tests.cpp 
b/libs/dfi/gtest/src/json_serializer_tests.cpp
index 6aeb5ec3..6105928d 100644
--- a/libs/dfi/gtest/src/json_serializer_tests.cpp
+++ b/libs/dfi/gtest/src/json_serializer_tests.cpp
@@ -34,16 +34,6 @@ extern "C" {
 #include "json_serializer.h"
 #include "celix_err.h"
 
-static void stdLog(void*, int level, const char *file, int line, const char 
*msg, ...) {
-       va_list ap;
-       const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"};
-       fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line);
-       va_start(ap, msg);
-       vfprintf(stderr, msg, ap);
-       fprintf(stderr, "\n");
-       va_end(ap);
-}
-
 /*********** example 1 ************************/
 /** struct type ******************************/
 const char *example1_descriptor = "{DJISF a b c d e}";
@@ -780,11 +770,6 @@ void writeEnumFailed(void) {
 class JsonSerializerTests : public ::testing::Test {
 public:
     JsonSerializerTests() {
-        int lvl = 1;
-        dynCommon_logSetup(stdLog, nullptr, lvl);
-        dynType_logSetup(stdLog, nullptr,lvl);
-        dynTypeCommon_logSetup(stdLog, nullptr,lvl);
-        jsonSerializer_logSetup(stdLog, nullptr, lvl);
     }
     ~JsonSerializerTests() override {
     }
diff --git a/libs/dfi/include/dfi_log_util.h b/libs/dfi/include/dfi_log_util.h
deleted file mode 100644
index 9c65d6b1..00000000
--- a/libs/dfi/include/dfi_log_util.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef _DFI_LOG_UTIL_H_
-#define _DFI_LOG_UTIL_H_
-
-/**
- * @deprecated The header will be remove, Use celix_err.h instead.
- */
-
-#include "celix_dfi_export.h"
-#include "celix_err.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*logf_ft)(void *handle, int level, const char *file, int line, 
const char *format, ...);
-
-#define DFI_SETUP_LOG_HEADER(cmp) \
-    void cmp ## _logSetup(logf_ft logf, void *handle, int currentLogLevel);
-
-#define DFI_SETUP_LOG(cmp) \
-    static logf_ft g_logf = NULL; \
-    static void *g_logHandle = NULL; \
-    static int g_currentLogLevel = 1; \
-    \
-    CELIX_DFI_EXPORT void cmp ## _logSetup(logf_ft logf, void *handle, int 
currentLogLevel) { \
-        g_currentLogLevel = currentLogLevel; \
-        g_logHandle = handle; \
-        g_logf = logf; \
-    }
-
-#define LOG_LVL_ERROR    1
-#define LOG_LVL_WARNING  2
-#define LOG_LVL_INFO     3
-#define LOG_LVL_DEBUG    4
-
-#define LOG_ERROR(msg, ...) celix_err_pushf((msg), ##__VA_ARGS__)
-
-#define LOG_WARNING(msg, ...) \
-    if (g_logf != NULL && g_currentLogLevel >= LOG_LVL_WARNING) { \
-        g_logf(g_logHandle, LOG_LVL_WARNING, __FILE__, __LINE__, (msg), 
##__VA_ARGS__); \
-    }
-
-#define LOG_INFO(msg, ...) \
-    if (g_logf != NULL && g_currentLogLevel >= LOG_LVL_INFO) { \
-        g_logf(g_logHandle, LOG_LVL_INFO, __FILE__, __LINE__, (msg), 
##__VA_ARGS__); \
-    }
-
-#define LOG_DEBUG(msg, ...) \
-    if (g_logf != NULL && g_currentLogLevel >= LOG_LVL_DEBUG) { \
-        g_logf(g_logHandle, LOG_LVL_DEBUG, __FILE__, __LINE__, (msg), 
##__VA_ARGS__); \
-    }
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/libs/dfi/include/dyn_common.h b/libs/dfi/include/dyn_common.h
index 1c44280b..ad17bed0 100644
--- a/libs/dfi/include/dyn_common.h
+++ b/libs/dfi/include/dyn_common.h
@@ -25,16 +25,12 @@
 #include <string.h>
 #include <sys/queue.h>
 
-#include "dfi_log_util.h"
 #include "celix_dfi_export.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-//logging
-DFI_SETUP_LOG_HEADER(dynCommon) ;
-
 TAILQ_HEAD(namvals_head, namval_entry);
 
 struct namval_entry {
diff --git a/libs/dfi/include/dyn_function.h b/libs/dfi/include/dyn_function.h
index e812eeaf..c93f3ab6 100644
--- a/libs/dfi/include/dyn_function.h
+++ b/libs/dfi/include/dyn_function.h
@@ -21,7 +21,6 @@
 #define __DYN_FUNCTION_H_
 
 #include "dyn_type.h"
-#include "dfi_log_util.h"
 #include "celix_dfi_export.h"
 
 #ifdef __cplusplus
@@ -45,8 +44,6 @@ extern "C" {
 
 typedef struct _dyn_function_type dyn_function_type;
 
-DFI_SETUP_LOG_HEADER(dynFunction);
-
 enum dyn_function_argument_meta {
     DYN_FUNCTION_ARGUMENT_META__STD = 0,
     DYN_FUNCTION_ARGUMENT_META__HANDLE = 1,
diff --git a/libs/dfi/include/dyn_interface.h b/libs/dfi/include/dyn_interface.h
index 0f80bec2..32c4d21d 100644
--- a/libs/dfi/include/dyn_interface.h
+++ b/libs/dfi/include/dyn_interface.h
@@ -23,7 +23,6 @@
 #include "dyn_common.h"
 #include "dyn_type.h"
 #include "dyn_function.h"
-#include "dfi_log_util.h"
 #include "celix_cleanup.h"
 #include "celix_version.h"
 #include "celix_dfi_export.h"
@@ -32,8 +31,6 @@
 extern "C" {
 #endif
 
-DFI_SETUP_LOG_HEADER(dynInterface);
-
 /* Description string
  *
  * Descriptor (interface) = HeaderSection AnnotationSection TypesSection 
MethodsSection
diff --git a/libs/dfi/include/dyn_message.h b/libs/dfi/include/dyn_message.h
index 2b719efa..1a29c187 100644
--- a/libs/dfi/include/dyn_message.h
+++ b/libs/dfi/include/dyn_message.h
@@ -22,7 +22,6 @@
 
 #include "dyn_common.h"
 #include "dyn_type.h"
-#include "dfi_log_util.h"
 #include "celix_version.h"
 #include "celix_dfi_export.h"
 
@@ -30,8 +29,6 @@
 extern "C" {
 #endif
 
-DFI_SETUP_LOG_HEADER(dynMessage);
-
 /* Description string
  *
  * Descriptor (message) = HeaderSection AnnotationSection TypesSection 
MessageSection
diff --git a/libs/dfi/include/dyn_type.h b/libs/dfi/include/dyn_type.h
index c8a963ea..13fe4396 100644
--- a/libs/dfi/include/dyn_type.h
+++ b/libs/dfi/include/dyn_type.h
@@ -25,7 +25,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#include "dfi_log_util.h"
 #include "celix_dfi_export.h"
 
 #ifdef __cplusplus
@@ -135,9 +134,6 @@ struct meta_entry {
     TAILQ_ENTRY(meta_entry) entries;
 };
 
-//logging
-DFI_SETUP_LOG_HEADER(dynType);
-
 /**
  * Parses a descriptor stream and creates a dyn_type (dynamic type).
  * If successful the type output argument points to the newly created dyn type.
diff --git a/libs/dfi/include/json_rpc.h b/libs/dfi/include/json_rpc.h
index 931a37df..cdbf3fc3 100644
--- a/libs/dfi/include/json_rpc.h
+++ b/libs/dfi/include/json_rpc.h
@@ -21,7 +21,6 @@
 #define __JSON_RPC_H_
 
 #include <jansson.h>
-#include "dfi_log_util.h"
 #include "dyn_type.h"
 #include "dyn_function.h"
 #include "dyn_interface.h"
@@ -31,9 +30,6 @@
 extern "C" {
 #endif
 
-//logging
-DFI_SETUP_LOG_HEADER(jsonRpc);
-
 /**
  * @brief Call a remote service using JSON-RPC.
  *
diff --git a/libs/dfi/include/json_serializer.h 
b/libs/dfi/include/json_serializer.h
index 6ef61707..2e5d2ce9 100644
--- a/libs/dfi/include/json_serializer.h
+++ b/libs/dfi/include/json_serializer.h
@@ -21,7 +21,6 @@
 #define __JSON_SERIALIZER_H_
 
 #include <jansson.h>
-#include "dfi_log_util.h"
 #include "dyn_type.h"
 #include "dyn_function.h"
 #include "dyn_interface.h"
@@ -31,9 +30,6 @@
 extern "C" {
 #endif
 
-//logging
-DFI_SETUP_LOG_HEADER(jsonSerializer);
-
 /**
  * @brief Deserialize a JSON string to a given type.
  *
diff --git a/libs/dfi/src/dyn_common.c b/libs/dfi/src/dyn_common.c
index adc33c8d..8169978b 100644
--- a/libs/dfi/src/dyn_common.c
+++ b/libs/dfi/src/dyn_common.c
@@ -18,6 +18,7 @@
  */
 
 #include "dyn_common.h"
+#include "celix_err.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -32,8 +33,6 @@
 static const int OK = 0;
 static const int ERROR = 1;
 
-DFI_SETUP_LOG(dynCommon)
-
 static bool dynCommon_charIn(int c, const char *acceptedChars);
 
 int dynCommon_parseName(FILE *stream, char **result) {
@@ -60,13 +59,13 @@ int dynCommon_parseNameAlsoAccept(FILE *stream, const char 
*acceptedChars, char
         ungetc(c, stream);
     } else {
         status = ERROR;
-        LOG_ERROR("Error creating mem stream for name. %s", strerror(errno));
+        celix_err_pushf("Error creating mem stream for name. %s", 
strerror(errno));
     }
 
     if (status == OK) {
         if (strLen == 0) {
             status = ERROR;
-            LOG_ERROR("Parsed empty name");
+            celix_err_pushf("Parsed empty name");
         }
     }
 
@@ -114,7 +113,7 @@ int dynCommon_eatChar(FILE *stream, int expected) {
     int c = fgetc(stream);
     if (c != expected) {
         status = ERROR;
-        LOG_ERROR("Error parsing, expected token '%c' got '%c' at position 
%li", expected, c, loc);
+        celix_err_pushf("Error parsing, expected token '%c' got '%c' at 
position %li", expected, c, loc);
     }
     return status;
 }
diff --git a/libs/dfi/src/dyn_function.c b/libs/dfi/src/dyn_function.c
index 1b6666cc..eb9903b1 100644
--- a/libs/dfi/src/dyn_function.c
+++ b/libs/dfi/src/dyn_function.c
@@ -19,6 +19,7 @@
 
 #include "dyn_function.h"
 #include "dyn_function_common.h"
+#include "celix_err.h"
 
 #include <strings.h>
 #include <stdlib.h>
@@ -30,8 +31,6 @@ static const int MEM_ERROR = 1;
 static const int PARSE_ERROR = 2;
 static const int ERROR = 2;
 
-DFI_SETUP_LOG(dynFunction)
-
 static int dynFunction_initCif(dyn_function_type *dynFunc);
 static int dynFunction_parseDescriptor(dyn_function_type *dynFunc, FILE 
*descriptor);
 static void dynFunction_ffiBind(ffi_cif *cif, void *ret, void *args[], void 
*userData);
@@ -51,12 +50,12 @@ int dynFunction_parse(FILE *descriptor, struct types_head 
*refTypes, dyn_functio
         if (status == 0) {
             int rc = dynFunction_initCif(dynFunc);
             if (rc != 0) {
-                LOG_ERROR("Error initializing cif");
+                celix_err_pushf("Error initializing cif");
                 status = ERROR;
             }
         }
     } else {
-        LOG_ERROR("Error allocating memory for dyn function\n");
+        celix_err_pushf("Error allocating memory for dyn function\n");
         status = MEM_ERROR;
     }
 
@@ -81,7 +80,7 @@ int dynFunction_parse(FILE *descriptor, struct types_head 
*refTypes, dyn_functio
     if (status == OK) {
         *out = dynFunc;
     }    else {
-        LOG_ERROR("Failed to Create dyn function");
+        celix_err_pushf("Failed to Create dyn function");
         if (dynFunc != NULL) {
             dynFunction_destroy(dynFunc);
         }
@@ -99,7 +98,7 @@ int dynFunction_parseWithStr(const char *descriptor, struct 
types_head *refTypes
         fclose(stream);
     } else {
         status = MEM_ERROR;
-        LOG_ERROR("Error creating mem stream for descriptor string. %s", 
strerror(errno)); 
+        celix_err_pushf("Error creating mem stream for descriptor string. %s", 
strerror(errno));
     }
     return status;
 }
@@ -118,7 +117,7 @@ static int dynFunction_parseDescriptor(dyn_function_type 
*dynFunc, FILE *descrip
         int c = fgetc(descriptor);
         if ( c != '(') {
             status = PARSE_ERROR;
-            LOG_ERROR("Expected '(' token got '%c'", c);
+            celix_err_pushf("Expected '(' token got '%c'", c);
         }
     }
 
@@ -143,7 +142,7 @@ static int dynFunction_parseDescriptor(dyn_function_type 
*dynFunc, FILE *descrip
 
                 index += 1;
             } else {
-                LOG_ERROR("Error allocating memory");
+                celix_err_pushf("Error allocating memory");
                 status = MEM_ERROR;
             }
         }
diff --git a/libs/dfi/src/dyn_interface.c b/libs/dfi/src/dyn_interface.c
index bad96335..aab77bf8 100644
--- a/libs/dfi/src/dyn_interface.c
+++ b/libs/dfi/src/dyn_interface.c
@@ -18,6 +18,7 @@
  */
 
 #include "dyn_interface.h"
+#include "celix_err.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -26,7 +27,6 @@
 #include "dyn_type.h"
 #include "dyn_interface_common.h"
 
-DFI_SETUP_LOG(dynInterface);
 
 static const int OK = 0;
 static const int ERROR = 1;
@@ -78,12 +78,12 @@ int dynInterface_parse(FILE *descriptor, dyn_interface_type 
**out) {
                 status = intf->version != NULL ? OK : ERROR;
             }
             if (status == ERROR) {
-               LOG_ERROR("Invalid version (%s) in parsed 
descriptor\n",version);
+                celix_err_pushf("Invalid version (%s) in parsed 
descriptor\n",version);
             }
         }
     } else {
         status = ERROR;
-        LOG_ERROR("Error allocating memory for dynamic interface\n");
+        celix_err_pushf("Error allocating memory for dynamic interface\n");
     }
 
     if (status == OK) {
@@ -115,7 +115,7 @@ int dynInterface_checkInterface(dyn_interface_type *intf) {
 
         if (!foundType || !foundVersion || !foundName) {
             status = ERROR;
-            LOG_ERROR("Parse Error. There must be a header section with a 
type, version and name entry");
+            celix_err_pushf("Parse Error. There must be a header section with 
a type, version and name entry");
         }
 
         struct method_entry *mEntry = NULL;
@@ -124,7 +124,7 @@ int dynInterface_checkInterface(dyn_interface_type *intf) {
             int descriptor = dynType_descriptorType(type);
             if (descriptor != 'N') {
                 status = ERROR;
-                LOG_ERROR("Parse Error. Only method with a return type 'N' 
(native int) are supported. Got return type '%c'\n", descriptor);
+                celix_err_pushf("Parse Error. Only method with a return type 
'N' (native int) are supported. Got return type '%c'\n", descriptor);
                 break;
             }
         }
@@ -158,7 +158,7 @@ static int dynInterface_parseSection(dyn_interface_type 
*intf, FILE *stream) {
             status = dynInterface_parseMethods(intf, stream);
         } else {
             status = ERROR;
-            LOG_ERROR("unsupported section '%s'", sectionName);
+            celix_err_pushf("unsupported section '%s'", sectionName);
         }
     }
 
@@ -201,7 +201,7 @@ static int 
dynInterface_parseNameValueSection(dyn_interface_type *intf, FILE *st
                 TAILQ_INSERT_TAIL(head, entry, entries);
             } else {
                 status = ERROR;
-                LOG_ERROR("Error allocating memory for namval entry");
+                celix_err_pushf("Error allocating memory for namval entry");
             }
         }
 
@@ -256,7 +256,7 @@ static int dynInterface_parseTypes(dyn_interface_type 
*intf, FILE *stream) {
                 TAILQ_INSERT_TAIL(&intf->types, entry, entries);
             } else {
                 status = ERROR;
-                LOG_ERROR("Error allocating memory for type entry");
+                celix_err_pushf("Error allocating memory for type entry");
             }
         }
 
@@ -321,7 +321,7 @@ static int dynInterface_parseMethods(dyn_interface_type 
*intf, FILE *stream) {
                 TAILQ_INSERT_TAIL(&intf->methods, entry, entries);
             } else {
                 status = ERROR;
-                LOG_ERROR("Error allocating memory for method entry");
+                celix_err_pushf("Error allocating memory for method entry");
             }
         }
 
@@ -418,7 +418,7 @@ static int dynInterface_getEntryForHead(struct namvals_head 
*head, const char *n
         *out = value;
     } else {
         status = ERROR;
-        LOG_ERROR("Cannot find '%s' in list", name);
+        celix_err_pushf("Cannot find '%s' in list", name);
     }
     return status;
 }
diff --git a/libs/dfi/src/dyn_message.c b/libs/dfi/src/dyn_message.c
index 0571be09..e020a812 100644
--- a/libs/dfi/src/dyn_message.c
+++ b/libs/dfi/src/dyn_message.c
@@ -18,6 +18,7 @@
  */
 
 #include "dyn_message.h"
+#include "celix_err.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -25,8 +26,6 @@
 #include "dyn_common.h"
 #include "dyn_type.h"
 
-DFI_SETUP_LOG(dynMessage);
-
 struct _dyn_message_type {
     struct namvals_head header;
     struct namvals_head annotations;
@@ -83,19 +82,19 @@ int dynMessage_parse(FILE *descriptor, dyn_message_type 
**out) {
                 status = msg->msgVersion != NULL ? OK : ERROR;
                }
                if (status == ERROR) {
-                       LOG_ERROR("Invalid version (%s) in parsed 
descriptor\n",version);
+                celix_err_pushf("Invalid version (%s) in parsed 
descriptor\n",version);
                }
         }
 
     } else {
         status = ERROR;
-        LOG_ERROR("Error allocating memory for dynamic message\n");
+        celix_err_pushf("Error allocating memory for dynamic message\n");
     }
 
     if (status == OK) {
         *out = msg;
     } else if (msg != NULL) {
-        LOG_ERROR("Error parsing msg\n");
+        celix_err_pushf("Error parsing msg\n");
         dynMessage_destroy(msg);
     }
     return status;
@@ -122,7 +121,7 @@ static int dynMessage_checkMessage(dyn_message_type *msg) {
 
         if (!foundType || !foundVersion || !foundName) {
             status = ERROR;
-            LOG_ERROR("Parse Error. There must be a header section with a 
type, version and name entry");
+            celix_err_pushf("Parse Error. There must be a header section with 
a type, version and name entry");
         }
     }
 
@@ -154,7 +153,7 @@ static int dynMessage_parseSection(dyn_message_type *msg, 
FILE *stream) {
             status = dynMessage_parseMessage(msg, stream);
         } else {
             status = ERROR;
-            LOG_ERROR("unsupported section '%s'", sectionName);
+            celix_err_pushf("unsupported section '%s'", sectionName);
         }
     }
 
@@ -197,7 +196,7 @@ static int 
dynMessage_parseNameValueSection(dyn_message_type *msg, FILE *stream,
                 TAILQ_INSERT_TAIL(head, entry, entries);
             } else {
                 status = ERROR;
-                LOG_ERROR("Error allocating memory for namval entry");
+                celix_err_pushf("Error allocating memory for namval entry");
             }
         }
 
@@ -249,7 +248,7 @@ static int dynMessage_parseTypes(dyn_message_type *msg, 
FILE *stream) {
                 TAILQ_INSERT_TAIL(&msg->types, entry, entries);
             } else {
                 status = ERROR;
-                LOG_ERROR("Error allocating memory for type entry");
+                celix_err_pushf("Error allocating memory for type entry");
             }
         }
 
@@ -347,7 +346,7 @@ static int dynMessage_getEntryForHead(struct namvals_head 
*head, const char *nam
         *out = value;
     } else {
         status = ERROR;
-        LOG_ERROR("Cannot find '%s' in list", name);
+        celix_err_pushf("Cannot find '%s' in list", name);
     }
     return status;
 }
diff --git a/libs/dfi/src/dyn_type.c b/libs/dfi/src/dyn_type.c
index df2021bf..507f6c4a 100644
--- a/libs/dfi/src/dyn_type.c
+++ b/libs/dfi/src/dyn_type.c
@@ -18,18 +18,16 @@
  */
 
 #include "dyn_type.h"
+#include "dyn_type_common.h"
+#include "dyn_type_common.h"
+#include "dyn_common.h"
+#include "celix_err.h"
 
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <ffi.h>
-#include "dyn_type_common.h"
-
-#include "dyn_type_common.h"
-#include "dyn_common.h"
-
-DFI_SETUP_LOG(dynType)
 
 static const int OK = 0;
 static const int ERROR = 1;
@@ -97,13 +95,13 @@ int dynType_parseWithStr(const char *descriptor, const char 
*name, struct types_
                 status = PARSE_ERROR;
                 dynType_destroy(*type);
                 *type = NULL;
-                LOG_ERROR("Expected EOF got %c", c);
+                celix_err_pushf("Expected EOF got %c", c);
             }
         } 
         fclose(stream);
     } else {
         status = ERROR;
-        LOG_ERROR("Error creating mem stream for descriptor string. %s", 
strerror(errno)); 
+        celix_err_pushf("Error creating mem stream for descriptor string. %s", 
strerror(errno));
     }
     return status;
 }
@@ -121,7 +119,7 @@ static int dynType_parseWithStream(FILE *stream, const char 
*name, dyn_type *par
             type->name = strdup(name);
             if (type->name == NULL) {
                 status = MEM_ERROR;
-                LOG_ERROR("Error strdup'ing name '%s'\n", name);               
        
+                celix_err_pushf("Error strdup'ing name '%s'\n", name);
             } 
         }
         if (status == OK) {
@@ -134,7 +132,7 @@ static int dynType_parseWithStream(FILE *stream, const char 
*name, dyn_type *par
         }
     } else {
         status = MEM_ERROR;
-        LOG_ERROR("Error allocating memory for type");
+        celix_err_pushf("Error allocating memory for type");
     }
     return status;
 }
@@ -216,7 +214,7 @@ static int dynType_parseMetaInfo(FILE *stream, dyn_type 
*type) {
         entry->value = value;
         TAILQ_INSERT_TAIL(&type->metaProperties, entry, entries);
     } else {
-        LOG_ERROR("Failed to parse meta properties");
+        celix_err_pushf("Failed to parse meta properties");
         free(name);
         free(value);
         free(entry);
@@ -266,7 +264,7 @@ static int dynType_parseComplex(FILE *stream, dyn_type 
*type) {
         } else {
             free(entry);
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for type");
+            celix_err_pushf("Error allocating memory for type");
         }
 
         if (status != OK) {
@@ -310,7 +308,7 @@ static int dynType_parseComplex(FILE *stream, dyn_type 
*type) {
             }
         } else {
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for elements");
+            celix_err_pushf("Error allocating memory for elements");
         }
     }
 
@@ -323,7 +321,7 @@ static int dynType_parseComplex(FILE *stream, dyn_type 
*type) {
             }
         } else {
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for type");
+            celix_err_pushf("Error allocating memory for type");
         }
     }
 
@@ -351,14 +349,14 @@ static int dynType_parseNestedType(FILE *stream, dyn_type 
*type) {
         entry->type->name = name;
     } else {
         status = MEM_ERROR;
-        LOG_ERROR("Error allocating entry");
+        celix_err_pushf("Error allocating entry");
     }     
 
     if (status == OK) {
         int c = fgetc(stream);
         if (c != '=') {
             status = PARSE_ERROR;
-            LOG_ERROR("Error parsing nested type expected '=' got '%c'", c);
+            celix_err_pushf("Error parsing nested type expected '=' got '%c'", 
c);
         }
     }
 
@@ -367,7 +365,7 @@ static int dynType_parseNestedType(FILE *stream, dyn_type 
*type) {
         int c = fgetc(stream);
         if (c != ';') {
             status = PARSE_ERROR;
-            LOG_ERROR("Expected ';' got '%c'\n", c);
+            celix_err_pushf("Expected ';' got '%c'\n", c);
         }
     }
 
@@ -393,7 +391,7 @@ static int dynType_parseReference(FILE *stream, dyn_type 
*type) {
         status = dynType_parseRefByValue(stream, subType);
     } else {
         status = MEM_ERROR;
-        LOG_ERROR("Error allocating memory for subtype\n");
+        celix_err_pushf("Error allocating memory for subtype\n");
     }
 
     return status;
@@ -412,7 +410,7 @@ static int dynType_parseRefByValue(FILE *stream, dyn_type 
*type) {
             type->ref.ref = ref;
         } else {
             status = PARSE_ERROR;
-            LOG_ERROR("Error cannot find type '%s'", name);
+            celix_err_pushf("Error cannot find type '%s'", name);
         }
         free(name);
     } 
@@ -421,7 +419,7 @@ static int dynType_parseRefByValue(FILE *stream, dyn_type 
*type) {
         int c = fgetc(stream);
         if (c != ';') {
             status = PARSE_ERROR;
-            LOG_ERROR("Error expected ';' got '%c'", c);
+            celix_err_pushf("Error expected ';' got '%c'", c);
         } 
     }
 
@@ -471,7 +469,7 @@ static int dynType_parseSimple(int c, dyn_type *type) {
         type->ffiType = ffiType;
     } else {
         status = PARSE_ERROR;
-        LOG_ERROR("Error unsupported type '%c'", c);
+        celix_err_pushf("Error unsupported type '%c'", c);
     }
 
     return status;
@@ -583,7 +581,7 @@ int dynType_alloc(dyn_type *type, void **bufLoc) {
             *bufLoc = inst;
         } else {
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for type '%c'", 
type->descriptor);
+            celix_err_pushf("Error allocating memory for type '%c'", 
type->descriptor);
         }
     }
 
@@ -675,11 +673,11 @@ int dynType_sequence_alloc(dyn_type *type, void *inst, 
uint32_t cap) {
         } else {
             seq->cap = 0;
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for buf");
+            celix_err_pushf("Error allocating memory for buf");
         }
     } else {
-            status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for seq");
+        status = MEM_ERROR;
+        celix_err_pushf("Error allocating memory for seq");
     }
     return status;
 }
@@ -696,11 +694,11 @@ int dynType_sequence_reserve(dyn_type *type, void *inst, 
uint32_t cap) {
         } else {
             seq->cap = 0;
             status = MEM_ERROR;
-            LOG_ERROR("Error allocating memory for buf");
+            celix_err_pushf("Error allocating memory for buf");
         }
     } else {
         status = MEM_ERROR;
-        LOG_ERROR("Error allocating memory for seq");
+        celix_err_pushf("Error allocating memory for seq");
     }
     return status;
 }
@@ -737,7 +735,7 @@ void dynType_deepFree(dyn_type *type, void *loc, bool 
alsoDeleteSelf) {
                 //nop
                 break;
             default:
-                LOG_ERROR("Unexpected switch case. cannot free dyn type %c\n", 
type->descriptor);
+                celix_err_pushf("Unexpected switch case. cannot free dyn type 
%c\n", type->descriptor);
                 break;
         }
 
@@ -785,12 +783,12 @@ int dynType_sequence_locForIndex(dyn_type *type, void 
*seqLoc, int index, void *
 
     if (index >= seq->cap) {
         status = ERROR;
-        LOG_ERROR("Requested index (%i) is greater than capacity (%u) of 
sequence", index, seq->cap);
+        celix_err_pushf("Requested index (%i) is greater than capacity (%u) of 
sequence", index, seq->cap);
     }
 
     if (index >= seq->len) {
         status = ERROR;
-        LOG_ERROR("Requesting index (%i) outsize defined length (%u) but 
within capacity", index, seq->len);
+        celix_err_pushf("Requesting index (%i) outsize defined length (%u) but 
within capacity", index, seq->len);
     }
 
     if (status == OK) {
@@ -811,7 +809,7 @@ int 
dynType_sequence_increaseLengthAndReturnLastLoc(dyn_type *type, void *seqLoc
         seq->len += 1;
     } else {
         status = ERROR;
-        LOG_ERROR("Cannot increase sequence length beyond capacity (%u)", 
seq->cap);
+        celix_err_pushf("Cannot increase sequence length beyond capacity 
(%u)", seq->cap);
     }
 
     if (status == OK) {
@@ -966,7 +964,7 @@ int dynType_text_allocAndInit(dyn_type *type, void 
*textLoc, const char *value)
         *loc = str;
     } else {
         status = ERROR;
-        LOG_ERROR("Cannot allocate memory for string");
+        celix_err_pushf("Cannot allocate memory for string");
     }
     return status;
 }
diff --git a/libs/dfi/src/dyn_type_common.c b/libs/dfi/src/dyn_type_common.c
index 4db783c2..6de30f45 100644
--- a/libs/dfi/src/dyn_type_common.c
+++ b/libs/dfi/src/dyn_type_common.c
@@ -18,8 +18,8 @@
  */
 
 #include "dyn_type.h"
-
 #include "dyn_type_common.h"
+#include "celix_err.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -27,8 +27,6 @@
 #include <errno.h>
 #include <ffi.h>
 
-DFI_SETUP_LOG(dynTypeCommon)
-
 dyn_type * dynType_findType(dyn_type *type, char *name) {
     dyn_type *result = NULL;
 
@@ -62,7 +60,7 @@ dyn_type * dynType_findType(dyn_type *type, char *name) {
 ffi_type * dynType_ffiType(dyn_type * type) {
     if (type->type == DYN_TYPE_REF) {
         if (type->ref.ref == NULL) {
-            LOG_ERROR("Error. Ref for %s is not (yet) initialized", 
type->name);
+            celix_err_pushf("Error. Ref for %s is not (yet) initialized", 
type->name);
             return NULL;
         }
         return type->ref.ref->ffiType;
diff --git a/libs/dfi/src/dyn_type_common.h b/libs/dfi/src/dyn_type_common.h
index 856b9d32..45e8098a 100644
--- a/libs/dfi/src/dyn_type_common.h
+++ b/libs/dfi/src/dyn_type_common.h
@@ -25,14 +25,11 @@
 
 #include <ffi.h>
 
-#include "dfi_log_util.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-DFI_SETUP_LOG_HEADER(dynTypeCommon);
-
 struct _dyn_type {
     char *name;
     char descriptor;
diff --git a/libs/dfi/src/json_rpc.c b/libs/dfi/src/json_rpc.c
index c2f7f43d..359ca0ef 100644
--- a/libs/dfi/src/json_rpc.c
+++ b/libs/dfi/src/json_rpc.c
@@ -21,19 +21,19 @@
 #include "json_serializer.h"
 #include "dyn_type.h"
 #include "dyn_interface.h"
+#include "dyn_type_common.h"
+#include "celix_compiler.h"
+#include "celix_err.h"
+
 #include <jansson.h>
 #include <assert.h>
 #include <stdint.h>
 #include <string.h>
 #include <ffi.h>
-#include "celix_compiler.h"
-#include "dyn_type_common.h"
 
 static int OK = 0;
 static int ERROR = 1;
 
-DFI_SETUP_LOG(jsonRpc);
-
 typedef void (*gen_func_type)(void);
 
 struct generic_service_layout {
@@ -52,14 +52,14 @@ int jsonRpc_call(dyn_interface_type *intf, void *service, 
const char *request, c
        const char *sig;
        if (js_request) {
                if (json_unpack(js_request, "{s:s}", "m", &sig) != 0) {
-            LOG_ERROR("Got json error '%s'\n", error.text);
+            celix_err_pushf("Got json error '%s'\n", error.text);
             json_decref(js_request);
             return ERROR;
                } else {
                        arguments = json_object_get(js_request, "a");
                }
        } else {
-        LOG_ERROR("Got json error '%s' for '%s'\n", error.text, request);
+        celix_err_pushf("Got json error '%s' for '%s'\n", error.text, request);
                return ERROR;
        }
 
@@ -76,7 +76,7 @@ int jsonRpc_call(dyn_interface_type *intf, void *service, 
const char *request, c
 
        if (method == NULL) {
                status = ERROR;
-               LOG_ERROR("Cannot find method with sig '%s'", sig);
+        celix_err_pushf("Cannot find method with sig '%s'", sig);
        }
        else if (status == OK) {
                returnType = dynFunction_returnType(method->dynFunc);
@@ -139,7 +139,7 @@ int jsonRpc_call(dyn_interface_type *intf, void *service, 
const char *request, c
        if (status == OK) {
                if (dynType_descriptorType(returnType) != 'N') {
                        //NOTE To be able to handle exception only N as 
returnType is supported
-                       LOG_ERROR("Only interface methods with a native int are 
supported. Found type '%c'", (char)dynType_descriptorType(returnType));
+            celix_err_pushf("Only interface methods with a native int are 
supported. Found type '%c'", (char)dynType_descriptorType(returnType));
                        status = ERROR;
                }
        }
@@ -276,7 +276,7 @@ int jsonRpc_prepareInvokeRequest(dyn_function_type *func, 
const char *id, void *
                        if (rc == 0) {
                                json_array_append_new(arguments, val);
                        } else {
-                LOG_ERROR("Failed to serialize args for function '%s'\n", id);
+                celix_err_pushf("Failed to serialize args for function 
'%s'\n", id);
                                status = ERROR;
                                break;
                        }
@@ -305,7 +305,7 @@ int jsonRpc_handleReply(dyn_function_type *func, const char 
*reply, void *args[]
        json_t *replyJson = json_loads(reply, JSON_DECODE_ANY, &error);
        if (replyJson == NULL) {
                status = ERROR;
-               LOG_ERROR("Error parsing json '%s', got error '%s'", reply, 
error.text);
+        celix_err_pushf("Error parsing json '%s', got error '%s'", reply, 
error.text);
        }
 
        json_t *result = NULL;
@@ -332,12 +332,12 @@ int jsonRpc_handleReply(dyn_function_type *func, const 
char *reply, void *args[]
             nrOfOutputArgs += 1;
             if (nrOfOutputArgs > 1) {
                 status = ERROR;
-                LOG_ERROR("Only one output argument is supported");
+                celix_err_pushf("Only one output argument is supported");
                 break;
             }
             if (result == NULL && !replyHasError) {
                 status = ERROR;
-                LOG_ERROR("Expected result in reply. got '%s'", reply);
+                celix_err_pushf("Expected result in reply. got '%s'", reply);
                 break;
             }
         }
diff --git a/libs/dfi/src/json_serializer.c b/libs/dfi/src/json_serializer.c
index e24cc58d..dbbc5b74 100644
--- a/libs/dfi/src/json_serializer.c
+++ b/libs/dfi/src/json_serializer.c
@@ -21,6 +21,7 @@
 #include "dyn_type.h"
 #include "dyn_type_common.h"
 #include "dyn_interface.h"
+#include "celix_err.h"
 
 #include <jansson.h>
 #include <assert.h>
@@ -43,8 +44,6 @@ static int jsonSerializer_writeEnum(dyn_type *type, int32_t 
enum_value, json_t *
 static int OK = 0;
 static int ERROR = 1;
 
-DFI_SETUP_LOG(jsonSerializer);
-
 int jsonSerializer_deserialize(dyn_type *type, const char *input, size_t 
length, void **result) {
     assert(dynType_type(type) == DYN_TYPE_COMPLEX || dynType_type(type) == 
DYN_TYPE_SEQUENCE);
     int status = 0;
@@ -57,11 +56,11 @@ int jsonSerializer_deserialize(dyn_type *type, const char 
*input, size_t length,
         json_decref(root);
     } else {
         status = ERROR;
-        LOG_ERROR("Error parsing json input '%.*s'. Error is: %s\n", 
(int)length, input, error.text);
+        celix_err_pushf("Error parsing json input '%.*s'. Error is: %s\n", 
(int)length, input, error.text);
     }
 
     if (status != OK) {
-        LOG_ERROR("Error cannot deserialize json. Input is '%s'\n", input);
+        celix_err_pushf("Error cannot deserialize json. Input is '%s'\n", 
input);
     }
     return status;
 }
@@ -84,7 +83,7 @@ static int jsonSerializer_createType(dyn_type *type, json_t 
*val, void **result)
             *((char**)inst) = strdup(s);
         } else {
             status = ERROR;
-            LOG_ERROR("Expected json_string type got %i\n", json_typeof(val));
+            celix_err_pushf("Expected json_string type got %i\n", 
json_typeof(val));
         }
     } else {
         status = dynType_alloc(type, &inst);
@@ -229,7 +228,7 @@ static int jsonSerializer_parseAny(dyn_type *type, void 
*loc, json_t *val) {
                 status = jsonSerializer_parseEnum(type, 
json_string_value(val), E);
             } else {
                 status = ERROR;
-                LOG_ERROR("Expected json string for enum type but got %i", 
json_typeof(val));
+                celix_err_pushf("Expected json string for enum type but got 
%i", json_typeof(val));
             }
             break;
         case 't' :
@@ -239,7 +238,7 @@ static int jsonSerializer_parseAny(dyn_type *type, void 
*loc, json_t *val) {
                 dynType_text_allocAndInit(type, loc, json_string_value(val));
             } else {
                 status = ERROR;
-                LOG_ERROR("Expected json string type got %i", 
json_typeof(val));
+                celix_err_pushf("Expected json string type got %i", 
json_typeof(val));
             }
             break;
         case '[' :
@@ -247,7 +246,7 @@ static int jsonSerializer_parseAny(dyn_type *type, void 
*loc, json_t *val) {
                 status = jsonSerializer_parseSequence(type, val, loc);
             } else {
                 status = ERROR;
-                LOG_ERROR("Expected json array type got '%i'", 
json_typeof(val));
+                celix_err_pushf("Expected json array type got '%i'", 
json_typeof(val));
             }
             break;
         case '{' :
@@ -263,14 +262,14 @@ static int jsonSerializer_parseAny(dyn_type *type, void 
*loc, json_t *val) {
             break;
         case 'P' :
             status = ERROR;
-            LOG_ERROR("Untyped pointer are not supported for serialization");
+            celix_err_pushf("Untyped pointer are not supported for 
serialization");
             break;
         case 'l':
             status = jsonSerializer_parseAny(type->ref.ref, loc, val);
             break;
         default :
             status = ERROR;
-            LOG_ERROR("Error provided type '%c' not supported for JSON\n", 
dynType_descriptorType(type));
+            celix_err_pushf("Error provided type '%c' not supported for 
JSON\n", dynType_descriptorType(type));
             break;
     }
 
@@ -327,7 +326,7 @@ static int jsonSerializer_parseEnum(dyn_type *type, const 
char* enum_name, int32
         }
     }
 
-    LOG_ERROR("Could not find Enum value %s in enum type", enum_name);
+    celix_err_pushf("Could not find Enum value %s in enum type", enum_name);
     return ERROR;
 }
 
@@ -426,13 +425,13 @@ static int jsonSerializer_writeAny(dyn_type *type, void* 
input, json_t **out) {
             break;
         case 'P' :
             status = ERROR;
-            LOG_ERROR("Untyped pointer not supported for serialization.");
+            celix_err_pushf("Untyped pointer not supported for 
serialization.");
             break;
         case 'l':
             status = jsonSerializer_writeAny(type->ref.ref, input, out);
             break;
         default :
-            LOG_ERROR("Unsupported descriptor '%c'", descriptor);
+            celix_err_pushf("Unsupported descriptor '%c'", descriptor);
             status = ERROR;
             break;
     }
@@ -498,7 +497,7 @@ static int jsonSerializer_writeComplex(dyn_type *type, void 
*input, json_t **out
             dyn_type *subType = NULL;
             index = dynType_complex_indexForName(type, entry->name);
             if (index < 0) {
-                LOG_ERROR("Cannot find index for member '%s'", entry->name);
+                celix_err_pushf("Cannot find index for member '%s'", 
entry->name);
                 status = ERROR;
             }
             if(status == OK){
@@ -546,6 +545,6 @@ static int jsonSerializer_writeEnum(dyn_type *type, int32_t 
enum_value, json_t *
         }
     }
 
-    LOG_ERROR("Could not find Enum value %s in enum type", enum_value_str);
+    celix_err_pushf("Could not find Enum value %s in enum type", 
enum_value_str);
     return ERROR;
 }

Reply via email to