Ciprian are you ok with the naming now ?

I'd like to move this forward because coupled with removing ODP_ERR
calls from the tests it opens the door to simplifying the ODP API by
making these macros internal.

On 12 November 2014 19:28, Mike Holmes <[email protected]> wrote:
> Removing the calls to the ODP API error functions from applications
> allows the functions to be moved into the ODP APIs internal interface.
> Applications should consume ODP implementation error messages and not
> use the library for its own logging needs.
>
> Signed-off-by: Mike Holmes <[email protected]>
> ---
>  example/example_debug.h           | 88 
> +++++++++++++++++++++++++++++++++++++++
>  example/generator/Makefile.am     |  1 +
>  example/generator/odp_generator.c | 43 ++++++++++---------
>  example/ipsec/Makefile.am         |  1 +
>  example/ipsec/odp_ipsec.c         | 43 ++++++++++---------
>  example/ipsec/odp_ipsec_cache.c   |  4 +-
>  example/ipsec/odp_ipsec_fwd_db.c  |  4 +-
>  example/ipsec/odp_ipsec_loop_db.c |  4 +-
>  example/ipsec/odp_ipsec_sa_db.c   |  4 +-
>  example/ipsec/odp_ipsec_sp_db.c   |  4 +-
>  example/ipsec/odp_ipsec_stream.c  |  8 ++--
>  example/l2fwd/Makefile.am         |  1 +
>  example/l2fwd/odp_l2fwd.c         | 36 ++++++++--------
>  example/odp_example/Makefile.am   |  1 +
>  example/odp_example/odp_example.c | 75 +++++++++++++++++----------------
>  example/packet/Makefile.am        |  1 +
>  example/packet/odp_pktio.c        | 32 +++++++-------
>  example/timer/Makefile.am         |  1 +
>  example/timer/odp_timer_test.c    | 20 +++++----
>  19 files changed, 248 insertions(+), 123 deletions(-)
>  create mode 100644 example/example_debug.h
>
> diff --git a/example/example_debug.h b/example/example_debug.h
> new file mode 100644
> index 0000000..8ac3773
> --- /dev/null
> +++ b/example/example_debug.h
> @@ -0,0 +1,88 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +/**
> + * @file
> + *
> + * example debug
> + */
> +
> +#ifndef EXAMPLE_DEBUG_H_
> +#define EXAMPLE_DEBUG_H_
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#ifndef EXAMPLE_DEBUG_PRINT
> +#define EXAMPLE_DEBUG_PRINT 1
> +#endif
> +
> +/**
> + * log level.
> + */
> +typedef enum example_log_level {
> +       LOG_LVL_DBG,
> +       LOG_LVL_ERR,
> +       LOG_LVL_ABORT
> +} example_log_level_e;
> +
> +/**
> + * default LOG macro.
> + */
> +#define LOG(level, fmt, ...) \
> +do { \
> +       switch (level) { \
> +       case LOG_LVL_ERR: \
> +               fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \
> +               __LINE__, __func__, ##__VA_ARGS__); \
> +               break; \
> +       case LOG_LVL_DBG: \
> +               if (EXAMPLE_DEBUG_PRINT == 1) \
> +                       fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \
> +                       __LINE__, __func__, ##__VA_ARGS__); \
> +               break; \
> +       case LOG_LVL_ABORT: \
> +               fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
> +               __LINE__, __func__, ##__VA_ARGS__); \
> +               abort(); \
> +               break; \
> +       default: \
> +               fprintf(stderr, "Unknown LOG level"); \
> +               break;\
> +       } \
> +} while (0)
> +
> +/**
> + * Debug printing macro, which prints output when DEBUG flag is set.
> + */
> +#define LOG_DBG(fmt, ...) \
> +               LOG(LOG_LVL_DBG, fmt, ##__VA_ARGS__)
> +
> +/**
> + * Print output to stderr (file, line and function).
> + */
> +#define LOG_ERR(fmt, ...) \
> +               LOG(LOG_LVL_ERR, fmt, ##__VA_ARGS__)
> +
> +/**
> + * Print output to stderr (file, line and function),
> + * then abort.
> + */
> +#define LOG_ABORT(fmt, ...) \
> +               LOG(LOG_LVL_ABORT, fmt, ##__VA_ARGS__)
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/example/generator/Makefile.am b/example/generator/Makefile.am
> index 5b3d55a..10a2cdc 100644
> --- a/example/generator/Makefile.am
> +++ b/example/generator/Makefile.am
> @@ -2,5 +2,6 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_generator
>  odp_generator_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_generator_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_generator_SOURCES = odp_generator.c
> diff --git a/example/generator/odp_generator.c 
> b/example/generator/odp_generator.c
> index ffa5e62..81920c1 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -16,6 +16,8 @@
>  #include <unistd.h>
>  #include <sys/time.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odph_linux.h>
> @@ -55,7 +57,8 @@ typedef struct {
>         int number;             /**< packets number to be sent */
>         int payload;            /**< data len */
>         int timeout;            /**< wait time */
> -       int interval;           /**< wait interval ms between sending each 
> packet */
> +       int interval;           /**< wait interval ms between sending
> +                                    each packet */
>  } appl_args_t;
>
>  /**
> @@ -303,13 +306,13 @@ static void *gen_send_thread(void *arg)
>         /* Open a packet IO instance for this thread */
>         pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool);
>         if (pktio == ODP_PKTIO_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio create failed\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio create failed\n", thr);
>                 return NULL;
>         }
>
>         outq_def = odp_pktio_outq_getdef(pktio);
>         if (outq_def == ODP_QUEUE_INVALID) {
> -               ODP_ERR("  [%02i] Error: def output-Q query\n", thr);
> +               LOG_ERR("  [%02i] Error: def output-Q query\n", thr);
>                 return NULL;
>         }
>
> @@ -318,7 +321,7 @@ static void *gen_send_thread(void *arg)
>                 int err;
>                 buf = odp_buffer_alloc(thr_args->pool);
>                 if (!odp_buffer_is_valid(buf)) {
> -                       ODP_ERR("  [%2i] alloc_single failed\n", thr);
> +                       LOG_ERR("  [%2i] alloc_single failed\n", thr);
>                         return NULL;
>                 }
>
> @@ -329,7 +332,7 @@ static void *gen_send_thread(void *arg)
>
>                 err = odp_queue_enq(outq_def, buf);
>                 if (err != 0) {
> -                       ODP_ERR("  [%02i] send pkt err!\n", thr);
> +                       LOG_ERR("  [%02i] send pkt err!\n", thr);
>                         return NULL;
>                 }
>
> @@ -463,7 +466,7 @@ static void *gen_recv_thread(void *arg)
>         /* Open a packet IO instance for this thread */
>         pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool);
>         if (pktio == ODP_PKTIO_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio create failed\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio create failed\n", thr);
>                 return NULL;
>         }
>
> @@ -475,13 +478,13 @@ static void *gen_recv_thread(void *arg)
>         inq_name[ODP_QUEUE_NAME_LEN - 1] = '\0';
>         inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
>         if (inq_def == ODP_QUEUE_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio queue creation failed\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio queue creation failed\n", thr);
>                 return NULL;
>         }
>
>         ret = odp_pktio_inq_setdef(pktio, inq_def);
>         if (ret != 0) {
> -               ODP_ERR("  [%02i] Error: default input-Q setup\n", thr);
> +               LOG_ERR("  [%02i] Error: default input-Q setup\n", thr);
>                 return NULL;
>         }
>
> @@ -520,12 +523,12 @@ int main(int argc, char *argv[])
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> -               ODP_ERR("Error: ODP global init failed.\n");
> +               LOG_ERR("Error: ODP global init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
>         if (odp_init_local()) {
> -               ODP_ERR("Error: ODP local init failed.\n");
> +               LOG_ERR("Error: ODP local init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -541,7 +544,7 @@ int main(int argc, char *argv[])
>         args = odp_shm_addr(shm);
>
>         if (args == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(args, 0, sizeof(*args));
> @@ -584,7 +587,7 @@ int main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> +               LOG_ERR("Error: packet pool mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -594,7 +597,7 @@ int main(int argc, char *argv[])
>                                       ODP_CACHE_LINE_SIZE,
>                                       ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Error: packet pool create failed.\n");
> +               LOG_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         odp_buffer_pool_print(pool);
> @@ -636,7 +639,7 @@ int main(int argc, char *argv[])
>                         } else if (args->appl.mode == APPL_MODE_RCV) {
>                                 thr_run_func = gen_recv_thread;
>                         } else {
> -                               ODP_ERR("ERR MODE\n");
> +                               LOG_ERR("ERR MODE\n");
>                                 exit(EXIT_FAILURE);
>                         }
>                         /*
> @@ -754,35 +757,35 @@ static void parse_args(int argc, char *argv[], 
> appl_args_t *appl_args)
>                         } else if (optarg[0] == 'r') {
>                                 appl_args->mode = APPL_MODE_RCV;
>                         } else {
> -                               ODP_ERR("wrong mode!\n");
> +                               LOG_ERR("wrong mode!\n");
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
>
>                 case 'a':
>                         if (scan_mac(optarg, &appl_args->srcmac) != 1) {
> -                               ODP_ERR("wrong src mac:%s\n", optarg);
> +                               LOG_ERR("wrong src mac:%s\n", optarg);
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
>
>                 case 'b':
>                         if (scan_mac(optarg, &appl_args->dstmac) != 1) {
> -                               ODP_ERR("wrong dst mac:%s\n", optarg);
> +                               LOG_ERR("wrong dst mac:%s\n", optarg);
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
>
>                 case 'c':
>                         if (scan_ip(optarg, &appl_args->srcip) != 1) {
> -                               ODP_ERR("wrong src ip:%s\n", optarg);
> +                               LOG_ERR("wrong src ip:%s\n", optarg);
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
>
>                 case 'd':
>                         if (scan_ip(optarg, &appl_args->dstip) != 1) {
> -                               ODP_ERR("wrong dst ip:%s\n", optarg);
> +                               LOG_ERR("wrong dst ip:%s\n", optarg);
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
> @@ -802,7 +805,7 @@ static void parse_args(int argc, char *argv[], 
> appl_args_t *appl_args)
>                 case 'i':
>                         appl_args->interval = atoi(optarg);
>                         if (appl_args->interval <= 200 && geteuid() != 0) {
> -                               ODP_ERR("should be root user\n");
> +                               LOG_ERR("should be root user\n");
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
> diff --git a/example/ipsec/Makefile.am b/example/ipsec/Makefile.am
> index ac0949e..ee33143 100644
> --- a/example/ipsec/Makefile.am
> +++ b/example/ipsec/Makefile.am
> @@ -2,6 +2,7 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_ipsec
>  odp_ipsec_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_ipsec_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_ipsec_SOURCES = odp_ipsec.c \
>                          odp_ipsec_sa_db.c \
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index da6c48e..2aa26a4 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -15,6 +15,8 @@
>  #include <getopt.h>
>  #include <unistd.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odph_linux.h>
> @@ -234,7 +236,7 @@ int query_mac_address(char *intf, uint8_t *src_mac)
>         /* Get a socket descriptor */
>         sd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
>         if (sd < 0) {
> -               ODP_ERR("Error: socket() failed for %s\n", intf);
> +               LOG_ERR("Error: socket() failed for %s\n", intf);
>                 return -1;
>         }
>
> @@ -243,7 +245,7 @@ int query_mac_address(char *intf, uint8_t *src_mac)
>         snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", intf);
>         if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) {
>                 close(sd);
> -               ODP_ERR("Error: ioctl() failed for %s\n", intf);
> +               LOG_ERR("Error: ioctl() failed for %s\n", intf);
>                 return -1;
>         }
>         memcpy(src_mac, ifr.ifr_hwaddr.sa_data, ODPH_ETHADDR_LEN);
> @@ -382,7 +384,7 @@ void ipsec_init_pre(void)
>                                    ODP_QUEUE_TYPE_SCHED,
>                                    &qparam);
>         if (ODP_QUEUE_INVALID == completionq) {
> -               ODP_ERR("Error: completion queue creation failed\n");
> +               LOG_ERR("Error: completion queue creation failed\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -394,7 +396,7 @@ void ipsec_init_pre(void)
>                                ODP_QUEUE_TYPE_SCHED,
>                                &qparam);
>         if (ODP_QUEUE_INVALID == seqnumq) {
> -               ODP_ERR("Error: sequence number queue creation failed\n");
> +               LOG_ERR("Error: sequence number queue creation failed\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -411,7 +413,7 @@ void ipsec_init_pre(void)
>                                           ODP_BUFFER_TYPE_PACKET);
>
>         if (ODP_BUFFER_POOL_INVALID == out_pool) {
> -               ODP_ERR("Error: message pool create failed.\n");
> +               LOG_ERR("Error: message pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -454,7 +456,8 @@ void ipsec_init_post(crypto_api_mode_e api_mode)
>                                                      entry->input,
>                                                      completionq,
>                                                      out_pool)) {
> -                               ODP_ERR("Error: IPSec cache entry failed.\n");
> +                               LOG_ERR("Error: IPSec cache entry failed.\n"
> +                                               );
>                                 exit(EXIT_FAILURE);
>                         }
>                 } else {
> @@ -487,7 +490,7 @@ void initialize_loop(char *intf)
>         /* Derive loopback interface index */
>         idx = loop_if_index(intf);
>         if (idx < 0) {
> -               ODP_ERR("Error: loopback \"%s\" invalid\n", intf);
> +               LOG_ERR("Error: loopback \"%s\" invalid\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -500,7 +503,7 @@ void initialize_loop(char *intf)
>
>         inq_def = QUEUE_CREATE(queue_name, ODP_QUEUE_TYPE_SCHED, &qparam);
>         if (ODP_QUEUE_INVALID == inq_def) {
> -               ODP_ERR("Error: input queue creation failed for %s\n", intf);
> +               LOG_ERR("Error: input queue creation failed for %s\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>         /* Create output queue */
> @@ -512,7 +515,7 @@ void initialize_loop(char *intf)
>
>         outq_def = QUEUE_CREATE(queue_name, ODP_QUEUE_TYPE_POLL, &qparam);
>         if (ODP_QUEUE_INVALID == outq_def) {
> -               ODP_ERR("Error: output queue creation failed for %s\n", intf);
> +               LOG_ERR("Error: output queue creation failed for %s\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -556,7 +559,7 @@ void initialize_intf(char *intf)
>          */
>         pktio = odp_pktio_open(intf, pkt_pool);
>         if (ODP_PKTIO_INVALID == pktio) {
> -               ODP_ERR("Error: pktio create failed for %s\n", intf);
> +               LOG_ERR("Error: pktio create failed for %s\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>         outq_def = odp_pktio_outq_getdef(pktio);
> @@ -573,13 +576,13 @@ void initialize_intf(char *intf)
>
>         inq_def = QUEUE_CREATE(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
>         if (ODP_QUEUE_INVALID == inq_def) {
> -               ODP_ERR("Error: pktio queue creation failed for %s\n", intf);
> +               LOG_ERR("Error: pktio queue creation failed for %s\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>
>         ret = odp_pktio_inq_setdef(pktio, inq_def);
>         if (ret) {
> -               ODP_ERR("Error: default input-Q setup for %s\n", intf);
> +               LOG_ERR("Error: default input-Q setup for %s\n", intf);
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -590,7 +593,7 @@ void initialize_intf(char *intf)
>         ret = odp_pktio_get_mac_addr(pktio, src_mac);
>  #endif
>         if (ret) {
> -               ODP_ERR("Error: failed during MAC address get for %s\n", 
> intf);
> +               LOG_ERR("Error: failed during MAC address get for %s\n", 
> intf);
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -1176,13 +1179,13 @@ main(int argc, char *argv[])
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> -               ODP_ERR("Error: ODP global init failed.\n");
> +               LOG_ERR("Error: ODP global init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
>         /* Init this thread */
>         if (odp_init_local()) {
> -               ODP_ERR("Error: ODP local init failed.\n");
> +               LOG_ERR("Error: ODP local init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -1193,7 +1196,7 @@ main(int argc, char *argv[])
>         args = odp_shm_addr(shm);
>
>         if (NULL == args) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(args, 0, sizeof(*args));
> @@ -1238,7 +1241,7 @@ main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (NULL == pool_base) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> +               LOG_ERR("Error: packet pool mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -1248,7 +1251,7 @@ main(int argc, char *argv[])
>                                           ODP_CACHE_LINE_SIZE,
>                                           ODP_BUFFER_TYPE_PACKET);
>         if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
> -               ODP_ERR("Error: packet pool create failed.\n");
> +               LOG_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -1259,7 +1262,7 @@ main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (NULL == pool_base) {
> -               ODP_ERR("Error: context pool mem alloc failed.\n");
> +               LOG_ERR("Error: context pool mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -1269,7 +1272,7 @@ main(int argc, char *argv[])
>                                           ODP_CACHE_LINE_SIZE,
>                                           ODP_BUFFER_TYPE_RAW);
>         if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
> -               ODP_ERR("Error: context pool create failed.\n");
> +               LOG_ERR("Error: context pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
> index 1397d77..bb07dfc 100644
> --- a/example/ipsec/odp_ipsec_cache.c
> +++ b/example/ipsec/odp_ipsec_cache.c
> @@ -7,6 +7,8 @@
>  #include <stdlib.h>
>  #include <string.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odph_ipsec.h>
> @@ -28,7 +30,7 @@ void init_ipsec_cache(void)
>         ipsec_cache = odp_shm_addr(shm);
>
>         if (ipsec_cache == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(ipsec_cache, 0, sizeof(*ipsec_cache));
> diff --git a/example/ipsec/odp_ipsec_fwd_db.c 
> b/example/ipsec/odp_ipsec_fwd_db.c
> index e067db9..d6ac290 100644
> --- a/example/ipsec/odp_ipsec_fwd_db.c
> +++ b/example/ipsec/odp_ipsec_fwd_db.c
> @@ -7,6 +7,8 @@
>  #include <stdlib.h>
>  #include <string.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odp_ipsec_fwd_db.h>
> @@ -26,7 +28,7 @@ void init_fwd_db(void)
>         fwd_db = odp_shm_addr(shm);
>
>         if (fwd_db == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(fwd_db, 0, sizeof(*fwd_db));
> diff --git a/example/ipsec/odp_ipsec_loop_db.c 
> b/example/ipsec/odp_ipsec_loop_db.c
> index af4590a..cd14984 100644
> --- a/example/ipsec/odp_ipsec_loop_db.c
> +++ b/example/ipsec/odp_ipsec_loop_db.c
> @@ -7,6 +7,8 @@
>  #include <stdlib.h>
>  #include <string.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odp_ipsec_loop_db.h>
> @@ -26,7 +28,7 @@ void init_loopback_db(void)
>         loopback_db = odp_shm_addr(shm);
>
>         if (loopback_db == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(loopback_db, 0, sizeof(*loopback_db));
> diff --git a/example/ipsec/odp_ipsec_sa_db.c b/example/ipsec/odp_ipsec_sa_db.c
> index e8679db..4161d01 100644
> --- a/example/ipsec/odp_ipsec_sa_db.c
> +++ b/example/ipsec/odp_ipsec_sa_db.c
> @@ -7,6 +7,8 @@
>  #include <stdlib.h>
>  #include <string.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odp_ipsec_sa_db.h>
> @@ -26,7 +28,7 @@ void init_sa_db(void)
>         sa_db = odp_shm_addr(shm);
>
>         if (sa_db == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(sa_db, 0, sizeof(*sa_db));
> diff --git a/example/ipsec/odp_ipsec_sp_db.c b/example/ipsec/odp_ipsec_sp_db.c
> index f288dfe..11a9cf8 100644
> --- a/example/ipsec/odp_ipsec_sp_db.c
> +++ b/example/ipsec/odp_ipsec_sp_db.c
> @@ -7,6 +7,8 @@
>  #include <stdlib.h>
>  #include <string.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>  #include <odp_align.h>
>  #include <odp_crypto.h>
> @@ -28,7 +30,7 @@ void init_sp_db(void)
>         sp_db = odp_shm_addr(shm);
>
>         if (sp_db == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(sp_db, 0, sizeof(*sp_db));
> diff --git a/example/ipsec/odp_ipsec_stream.c 
> b/example/ipsec/odp_ipsec_stream.c
> index fa9aba8..2773060 100644
> --- a/example/ipsec/odp_ipsec_stream.c
> +++ b/example/ipsec/odp_ipsec_stream.c
> @@ -12,6 +12,8 @@
>  #include <openssl/hmac.h>
>  #include <openssl/evp.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>
>  #include <odph_packet.h>
> @@ -56,7 +58,7 @@ void init_stream_db(void)
>         stream_db = odp_shm_addr(shm);
>
>         if (stream_db == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(stream_db, 0, sizeof(*stream_db));
> @@ -100,7 +102,7 @@ int create_stream_db_entry(char *input)
>                 case 2:
>                         entry->input.loop = loop_if_index(token);
>                         if (entry->input.loop < 0) {
> -                               ODP_ERR("Error: stream must have input 
> loop\n");
> +                               LOG_ERR("Error: stream must have input 
> loop\n");
>                                 exit(EXIT_FAILURE);
>                         }
>                         break;
> @@ -479,7 +481,7 @@ int create_stream_db_inputs(void)
>         /* Lookup the packet pool */
>         pkt_pool = odp_buffer_pool_lookup("packet_pool");
>         if (pkt_pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Error: pkt_pool not found\n");
> +               LOG_ERR("Error: pkt_pool not found\n");
>                 exit(EXIT_FAILURE);
>         }
>
> diff --git a/example/l2fwd/Makefile.am b/example/l2fwd/Makefile.am
> index a83e757..a1813e1 100644
> --- a/example/l2fwd/Makefile.am
> +++ b/example/l2fwd/Makefile.am
> @@ -2,5 +2,6 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_l2fwd
>  odp_l2fwd_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_l2fwd_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_l2fwd_SOURCES = odp_l2fwd.c
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index 57037cd..18b0f5e 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -15,6 +15,8 @@
>  #include <getopt.h>
>  #include <unistd.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>  #include <odph_linux.h>
>  #include <odph_packet.h>
> @@ -128,7 +130,7 @@ static odp_pktio_t burst_mode_init_params(void *arg, 
> odp_buffer_pool_t pool)
>         /* Open a packet IO instance for this thread */
>         pktio = odp_pktio_open(args->srcif, pool);
>         if (pktio == ODP_PKTIO_INVALID)
> -               ODP_ERR("  Error: pktio create failed");
> +               LOG_ERR("  Error: pktio create failed");
>
>         return pktio;
>  }
> @@ -167,13 +169,13 @@ static odp_pktio_t queue_mode_init_params(void *arg, 
> odp_buffer_pool_t pool)
>
>         inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
>         if (inq_def == ODP_QUEUE_INVALID) {
> -               ODP_ERR("  Error: pktio queue creation failed");
> +               LOG_ERR("  Error: pktio queue creation failed");
>                 return ODP_PKTIO_INVALID;
>         }
>
>         ret = odp_pktio_inq_setdef(pktio, inq_def);
>         if (ret != 0) {
> -               ODP_ERR("  Error: default input-Q setup");
> +               LOG_ERR("  Error: default input-Q setup");
>                 return ODP_PKTIO_INVALID;
>         }
>
> @@ -200,7 +202,7 @@ static void *pktio_queue_thread(void *arg)
>         thr_args = arg;
>
>         if (thr_args->srcpktio == 0 || thr_args->dstpktio == 0) {
> -               ODP_ERR("Invalid srcpktio:%d dstpktio:%d\n",
> +               LOG_ERR("Invalid srcpktio:%d dstpktio:%d\n",
>                         thr_args->srcpktio, thr_args->dstpktio);
>                 return NULL;
>         }
> @@ -224,14 +226,14 @@ static void *pktio_queue_thread(void *arg)
>                 pkt = odp_packet_from_buffer(buf);
>                 /* Drop packets with errors */
>                 if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) {
> -                       ODP_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt);
> +                       LOG_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt);
>                         continue;
>                 }
>
>                 pktio_tmp = odp_pktio_get_input(pkt);
>                 outq_def = odp_pktio_outq_getdef(dstpktio[pktio_tmp]);
>                 if (outq_def == ODP_QUEUE_INVALID) {
> -                       ODP_ERR("  [%02i] Error: def output-Q query\n", thr);
> +                       LOG_ERR("  [%02i] Error: def output-Q query\n", thr);
>                         return NULL;
>                 }
>
> @@ -267,7 +269,7 @@ static void *pktio_ifburst_thread(void *arg)
>         thr_args = arg;
>
>         if (thr_args->srcpktio == 0 || thr_args->dstpktio == 0) {
> -               ODP_ERR("Invalid srcpktio:%d dstpktio:%d\n",
> +               LOG_ERR("Invalid srcpktio:%d dstpktio:%d\n",
>                         thr_args->srcpktio, thr_args->dstpktio);
>                 return NULL;
>         }
> @@ -286,7 +288,7 @@ static void *pktio_ifburst_thread(void *arg)
>                                 odp_pktio_send(thr_args->dstpktio, pkt_tbl,
>                                                pkts_ok);
>                         if (odp_unlikely(pkts_ok != pkts))
> -                               ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
> +                               LOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
>                                         pkts-pkts_ok, ++err_cnt);
>
>                         /* Print packet counts every once in a while */
> @@ -320,13 +322,13 @@ int main(int argc, char *argv[])
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> -               ODP_ERR("Error: ODP global init failed.\n");
> +               LOG_ERR("Error: ODP global init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
>         /* Init this thread */
>         if (odp_init_local()) {
> -               ODP_ERR("Error: ODP local init failed.\n");
> +               LOG_ERR("Error: ODP local init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -336,7 +338,7 @@ int main(int argc, char *argv[])
>         gbl_args = odp_shm_addr(shm);
>
>         if (gbl_args == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(gbl_args, 0, sizeof(*gbl_args));
> @@ -359,12 +361,12 @@ int main(int argc, char *argv[])
>         printf("Num worker threads: %i\n", num_workers);
>
>         if (num_workers < gbl_args->appl.if_count) {
> -               ODP_ERR("Error: core count %d is less than interface count\n",
> +               LOG_ERR("Error: core count %d is less than interface count\n",
>                         num_workers);
>                 exit(EXIT_FAILURE);
>         }
>         if (gbl_args->appl.if_count % 2 != 0) {
> -               ODP_ERR("Error: interface count %d is odd in fwd appl.\n",
> +               LOG_ERR("Error: interface count %d is odd in fwd appl.\n",
>                         gbl_args->appl.if_count);
>                 exit(EXIT_FAILURE);
>         }
> @@ -385,7 +387,7 @@ int main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> +               LOG_ERR("Error: packet pool mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -395,7 +397,7 @@ int main(int argc, char *argv[])
>                                       ODP_CACHE_LINE_SIZE,
>                                       ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Error: packet pool create failed.\n");
> +               LOG_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         odp_buffer_pool_print(pool);
> @@ -418,13 +420,13 @@ int main(int argc, char *argv[])
>                 if (gbl_args->appl.mode == APPL_MODE_PKT_BURST) {
>                         pktio = burst_mode_init_params(&gbl_args->thread[i], 
> pool);
>                         if (pktio == ODP_PKTIO_INVALID) {
> -                               ODP_ERR("  for thread:%02i\n", i);
> +                               LOG_ERR("  for thread:%02i\n", i);
>                                 exit(EXIT_FAILURE);
>                         }
>                 } else { /* APPL_MODE_PKT_QUEUE */
>                         pktio = queue_mode_init_params(&gbl_args->thread[i], 
> pool);
>                         if (pktio == ODP_PKTIO_INVALID) {
> -                               ODP_ERR("  for thread:%02i\n", i);
> +                               LOG_ERR("  for thread:%02i\n", i);
>                                 exit(EXIT_FAILURE);
>                         }
>                 }
> diff --git a/example/odp_example/Makefile.am b/example/odp_example/Makefile.am
> index e6f23d0..900f57c 100644
> --- a/example/odp_example/Makefile.am
> +++ b/example/odp_example/Makefile.am
> @@ -2,5 +2,6 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_example
>  odp_example_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_example_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_example_SOURCES = odp_example.c
> diff --git a/example/odp_example/odp_example.c 
> b/example/odp_example/odp_example.c
> index d0ec977..cdaf3a8 100644
> --- a/example/odp_example/odp_example.c
> +++ b/example/odp_example/odp_example.c
> @@ -13,6 +13,8 @@
>  #include <string.h>
>  #include <stdlib.h>
>
> +#include <example_debug.h>
> +
>  /* ODP main header */
>  #include <odp.h>
>
> @@ -93,7 +95,7 @@ static int create_queue(int thr, odp_buffer_pool_t 
> msg_pool, int prio)
>         buf = odp_buffer_alloc(msg_pool);
>
>         if (!odp_buffer_is_valid(buf)) {
> -               ODP_ERR("  [%i] msg_pool alloc failed\n", thr);
> +               LOG_ERR("  [%i] msg_pool alloc failed\n", thr);
>                 return -1;
>         }
>
> @@ -103,12 +105,12 @@ static int create_queue(int thr, odp_buffer_pool_t 
> msg_pool, int prio)
>         queue = odp_queue_lookup(name);
>
>         if (queue == ODP_QUEUE_INVALID) {
> -               ODP_ERR("  [%i] Queue %s lookup failed.\n", thr, name);
> +               LOG_ERR("  [%i] Queue %s lookup failed.\n", thr, name);
>                 return -1;
>         }
>
>         if (odp_queue_enq(queue, buf)) {
> -               ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +               LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                 return -1;
>         }
>
> @@ -142,19 +144,20 @@ static int create_queues(int thr, odp_buffer_pool_t 
> msg_pool, int prio)
>                 queue = odp_queue_lookup(name);
>
>                 if (queue == ODP_QUEUE_INVALID) {
> -                       ODP_ERR("  [%i] Queue %s lookup failed.\n", thr, 
> name);
> +                       LOG_ERR("  [%i] Queue %s lookup failed.\n", thr,
> +                               name);
>                         return -1;
>                 }
>
>                 buf = odp_buffer_alloc(msg_pool);
>
>                 if (!odp_buffer_is_valid(buf)) {
> -                       ODP_ERR("  [%i] msg_pool alloc failed\n", thr);
> +                       LOG_ERR("  [%i] msg_pool alloc failed\n", thr);
>                         return -1;
>                 }
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -183,7 +186,7 @@ static int test_alloc_single(int thr, odp_buffer_pool_t 
> pool)
>                 temp_buf = odp_buffer_alloc(pool);
>
>                 if (!odp_buffer_is_valid(temp_buf)) {
> -                       ODP_ERR("  [%i] alloc_single failed\n", thr);
> +                       LOG_ERR("  [%i] alloc_single failed\n", thr);
>                         return -1;
>                 }
>
> @@ -221,7 +224,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t 
> pool)
>                         temp_buf[j] = odp_buffer_alloc(pool);
>
>                         if (!odp_buffer_is_valid(temp_buf[j])) {
> -                               ODP_ERR("  [%i] alloc_multi failed\n", thr);
> +                               LOG_ERR("  [%i] alloc_multi failed\n", thr);
>                                 return -1;
>                         }
>                 }
> @@ -263,7 +266,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t 
> msg_pool)
>         buf = odp_buffer_alloc(msg_pool);
>
>         if (!odp_buffer_is_valid(buf)) {
> -               ODP_ERR("  [%i] msg_pool alloc failed\n", thr);
> +               LOG_ERR("  [%i] msg_pool alloc failed\n", thr);
>                 return -1;
>         }
>
> @@ -284,14 +287,14 @@ static int test_poll_queue(int thr, odp_buffer_pool_t 
> msg_pool)
>
>         for (i = 0; i < QUEUE_ROUNDS; i++) {
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>
>                 buf = odp_queue_deq(queue);
>
>                 if (!odp_buffer_is_valid(buf)) {
> -                       ODP_ERR("  [%i] Queue empty.\n", thr);
> +                       LOG_ERR("  [%i] Queue empty.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -340,7 +343,7 @@ static int test_schedule_one_single(const char *str, int 
> thr,
>                 buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -401,7 +404,7 @@ static int test_schedule_one_many(const char *str, int 
> thr,
>                 buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -459,7 +462,7 @@ static int test_schedule_single(const char *str, int thr,
>                 buf = odp_schedule(&queue, ODP_SCHED_WAIT);
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -478,7 +481,7 @@ static int test_schedule_single(const char *str, int thr,
>                 tot++;
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -538,7 +541,7 @@ static int test_schedule_many(const char *str, int thr,
>                 buf = odp_schedule(&queue, ODP_SCHED_WAIT);
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -557,7 +560,7 @@ static int test_schedule_many(const char *str, int thr,
>                 tot++;
>
>                 if (odp_queue_enq(queue, buf)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -616,7 +619,8 @@ static int test_schedule_multi(const char *str, int thr,
>                 queue = odp_queue_lookup(name);
>
>                 if (queue == ODP_QUEUE_INVALID) {
> -                       ODP_ERR("  [%i] Queue %s lookup failed.\n", thr, 
> name);
> +                       LOG_ERR("  [%i] Queue %s lookup failed.\n", thr,
> +                               name);
>                         return -1;
>                 }
>
> @@ -624,13 +628,14 @@ static int test_schedule_multi(const char *str, int thr,
>                         buf[j] = odp_buffer_alloc(msg_pool);
>
>                         if (!odp_buffer_is_valid(buf[j])) {
> -                               ODP_ERR("  [%i] msg_pool alloc failed\n", 
> thr);
> +                               LOG_ERR("  [%i] msg_pool alloc failed\n",
> +                                       thr);
>                                 return -1;
>                         }
>                 }
>
>                 if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -645,7 +650,7 @@ static int test_schedule_multi(const char *str, int thr,
>                 tot += num;
>
>                 if (odp_queue_enq_multi(queue, buf, num)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -663,7 +668,7 @@ static int test_schedule_multi(const char *str, int thr,
>                 tot += num;
>
>                 if (odp_queue_enq_multi(queue, buf, num)) {
> -                       ODP_ERR("  [%i] Queue enqueue failed.\n", thr);
> +                       LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
>                         return -1;
>                 }
>         }
> @@ -715,7 +720,7 @@ static void *run_thread(void *arg)
>         globals = odp_shm_addr(shm);
>
>         if (globals == NULL) {
> -               ODP_ERR("Shared mem lookup failed\n");
> +               LOG_ERR("Shared mem lookup failed\n");
>                 return NULL;
>         }
>
> @@ -735,7 +740,7 @@ static void *run_thread(void *arg)
>         msg_pool = odp_buffer_pool_lookup("msg_pool");
>
>         if (msg_pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("  [%i] msg_pool not found\n", thr);
> +               LOG_ERR("  [%i] msg_pool not found\n", thr);
>                 return NULL;
>         }
>
> @@ -835,7 +840,7 @@ static void test_time(void)
>         double err;
>
>         if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
> -               ODP_ERR("clock_gettime failed.\n");
> +               LOG_ERR("clock_gettime failed.\n");
>                 return;
>         }
>
> @@ -843,7 +848,7 @@ static void test_time(void)
>
>         do {
>                 if (clock_gettime(CLOCK_MONOTONIC, &tp1)) {
> -                       ODP_ERR("clock_gettime failed.\n");
> +                       LOG_ERR("clock_gettime failed.\n");
>                         return;
>                 }
>
> @@ -853,7 +858,7 @@ static void test_time(void)
>
>         do {
>                 if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
> -                       ODP_ERR("clock_gettime failed.\n");
> +                       LOG_ERR("clock_gettime failed.\n");
>                         return;
>                 }
>
> @@ -971,7 +976,7 @@ int main(int argc, char *argv[])
>
>         /* ODP global init */
>         if (odp_init_global(NULL, NULL)) {
> -               ODP_ERR("ODP global init failed.\n");
> +               LOG_ERR("ODP global init failed.\n");
>                 return -1;
>         }
>
> @@ -980,7 +985,7 @@ int main(int argc, char *argv[])
>          * setting up resources for worker threads.
>          */
>         if (odp_init_local()) {
> -               ODP_ERR("ODP global init failed.\n");
> +               LOG_ERR("ODP global init failed.\n");
>                 return -1;
>         }
>
> @@ -1028,7 +1033,7 @@ int main(int argc, char *argv[])
>         globals = odp_shm_addr(shm);
>
>         if (globals == NULL) {
> -               ODP_ERR("Shared memory reserve failed.\n");
> +               LOG_ERR("Shared memory reserve failed.\n");
>                 return -1;
>         }
>
> @@ -1043,7 +1048,7 @@ int main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (pool_base == NULL) {
> -               ODP_ERR("Shared memory reserve failed.\n");
> +               LOG_ERR("Shared memory reserve failed.\n");
>                 return -1;
>         }
>
> @@ -1052,7 +1057,7 @@ int main(int argc, char *argv[])
>                                       ODP_CACHE_LINE_SIZE, 
> ODP_BUFFER_TYPE_RAW);
>
>         if (pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Pool create failed.\n");
> +               LOG_ERR("Pool create failed.\n");
>                 return -1;
>         }
>
> @@ -1064,7 +1069,7 @@ int main(int argc, char *argv[])
>         queue = odp_queue_create("poll_queue", ODP_QUEUE_TYPE_POLL, NULL);
>
>         if (queue == ODP_QUEUE_INVALID) {
> -               ODP_ERR("Poll queue create failed.\n");
> +               LOG_ERR("Poll queue create failed.\n");
>                 return -1;
>         }
>
> @@ -1096,7 +1101,7 @@ int main(int argc, char *argv[])
>                                                  &param);
>
>                         if (queue == ODP_QUEUE_INVALID) {
> -                               ODP_ERR("Schedule queue create failed.\n");
> +                               LOG_ERR("Schedule queue create failed.\n");
>                                 return -1;
>                         }
>                 }
> @@ -1116,7 +1121,7 @@ int main(int argc, char *argv[])
>                                                 first_core);
>
>                 if (ret < 0) {
> -                       ODP_ERR("Fork workers failed %i\n", ret);
> +                       LOG_ERR("Fork workers failed %i\n", ret);
>                         return -1;
>                 }
>
> diff --git a/example/packet/Makefile.am b/example/packet/Makefile.am
> index 603a1ab..20e40a9 100644
> --- a/example/packet/Makefile.am
> +++ b/example/packet/Makefile.am
> @@ -2,5 +2,6 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_pktio
>  odp_pktio_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_pktio_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_pktio_SOURCES = odp_pktio.c
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 2cf3f0d..7cb7f66 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -15,6 +15,8 @@
>  #include <getopt.h>
>  #include <unistd.h>
>
> +#include <example_debug.h>
> +
>  #include <odp.h>
>  #include <odph_linux.h>
>  #include <odph_packet.h>
> @@ -130,14 +132,14 @@ static void *pktio_queue_thread(void *arg)
>         /* Lookup the packet pool */
>         pkt_pool = odp_buffer_pool_lookup("packet_pool");
>         if (pkt_pool == ODP_BUFFER_POOL_INVALID || pkt_pool != 
> thr_args->pool) {
> -               ODP_ERR("  [%02i] Error: pkt_pool not found\n", thr);
> +               LOG_ERR("  [%02i] Error: pkt_pool not found\n", thr);
>                 return NULL;
>         }
>
>         /* Open a packet IO instance for this thread */
>         pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool);
>         if (pktio == ODP_PKTIO_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio create failed\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio create failed\n", thr);
>                 return NULL;
>         }
>
> @@ -153,13 +155,14 @@ static void *pktio_queue_thread(void *arg)
>
>         inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
>         if (inq_def == ODP_QUEUE_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio queue creation failed\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio queue creation failed\n",
> +                       thr);
>                 return NULL;
>         }
>
>         ret = odp_pktio_inq_setdef(pktio, inq_def);
>         if (ret != 0) {
> -               ODP_ERR("  [%02i] Error: default input-Q setup\n", thr);
> +               LOG_ERR("  [%02i] Error: default input-Q setup\n", thr);
>                 return NULL;
>         }
>
> @@ -185,7 +188,7 @@ static void *pktio_queue_thread(void *arg)
>
>                 /* Drop packets with errors */
>                 if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) {
> -                       ODP_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt);
> +                       LOG_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt);
>                         continue;
>                 }
>
> @@ -193,7 +196,8 @@ static void *pktio_queue_thread(void *arg)
>                 outq_def = odp_pktio_outq_getdef(pktio_tmp);
>
>                 if (outq_def == ODP_QUEUE_INVALID) {
> -                       ODP_ERR("  [%02i] Error: def output-Q query\n", thr);
> +                       LOG_ERR("  [%02i] Error: def output-Q query\n",
> +                               thr);
>                         return NULL;
>                 }
>
> @@ -239,14 +243,14 @@ static void *pktio_ifburst_thread(void *arg)
>         /* Lookup the packet pool */
>         pkt_pool = odp_buffer_pool_lookup("packet_pool");
>         if (pkt_pool == ODP_BUFFER_POOL_INVALID || pkt_pool != 
> thr_args->pool) {
> -               ODP_ERR("  [%02i] Error: pkt_pool not found\n", thr);
> +               LOG_ERR("  [%02i] Error: pkt_pool not found\n", thr);
>                 return NULL;
>         }
>
>         /* Open a packet IO instance for this thread */
>         pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool);
>         if (pktio == ODP_PKTIO_INVALID) {
> -               ODP_ERR("  [%02i] Error: pktio create failed.\n", thr);
> +               LOG_ERR("  [%02i] Error: pktio create failed.\n", thr);
>                 return NULL;
>         }
>
> @@ -266,7 +270,7 @@ static void *pktio_ifburst_thread(void *arg)
>                         }
>
>                         if (odp_unlikely(pkts_ok != pkts))
> -                               ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
> +                               LOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
>                                         pkts-pkts_ok, ++err_cnt);
>
>                         /* Print packet counts every once in a while */
> @@ -300,13 +304,13 @@ int main(int argc, char *argv[])
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> -               ODP_ERR("Error: ODP global init failed.\n");
> +               LOG_ERR("Error: ODP global init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
>         /* Init this thread */
>         if (odp_init_local()) {
> -               ODP_ERR("Error: ODP local init failed.\n");
> +               LOG_ERR("Error: ODP local init failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -316,7 +320,7 @@ int main(int argc, char *argv[])
>         args = odp_shm_addr(shm);
>
>         if (args == NULL) {
> -               ODP_ERR("Error: shared mem alloc failed.\n");
> +               LOG_ERR("Error: shared mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         memset(args, 0, sizeof(*args));
> @@ -355,7 +359,7 @@ int main(int argc, char *argv[])
>         pool_base = odp_shm_addr(shm);
>
>         if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> +               LOG_ERR("Error: packet pool mem alloc failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
> @@ -365,7 +369,7 @@ int main(int argc, char *argv[])
>                                       ODP_CACHE_LINE_SIZE,
>                                       ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Error: packet pool create failed.\n");
> +               LOG_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>         odp_buffer_pool_print(pool);
> diff --git a/example/timer/Makefile.am b/example/timer/Makefile.am
> index 6229f13..f2e12bf 100644
> --- a/example/timer/Makefile.am
> +++ b/example/timer/Makefile.am
> @@ -2,5 +2,6 @@ include $(top_srcdir)/example/Makefile.inc
>
>  bin_PROGRAMS = odp_timer_test
>  odp_timer_test_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_timer_test_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/example
>
>  dist_odp_timer_test_SOURCES = odp_timer_test.c
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 78b2ae2..2a45fae 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -13,6 +13,8 @@
>  #include <string.h>
>  #include <stdlib.h>
>
> +#include <example_debug.h>
> +
>  /* ODP main header */
>  #include <odp.h>
>
> @@ -55,25 +57,25 @@ static void test_abs_timeouts(int thr, test_args_t *args)
>         odp_buffer_t buf;
>         int num;
>
> -       ODP_DBG("  [%i] test_timeouts\n", thr);
> +       LOG_DBG("  [%i] test_timeouts\n", thr);
>
>         queue = odp_queue_lookup("timer_queue");
>
>         period_ns = args->period_us*ODP_TIME_USEC;
>         period    = odp_timer_ns_to_tick(test_timer, period_ns);
>
> -       ODP_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
> +       LOG_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
>                 period, period_ns);
>
>         tick = odp_timer_current_tick(test_timer);
>
> -       ODP_DBG("  [%i] current tick %"PRIu64"\n", thr, tick);
> +       LOG_DBG("  [%i] current tick %"PRIu64"\n", thr, tick);
>
>         tick += period;
>
>         if (odp_timer_absolute_tmo(test_timer, tick, queue, 
> ODP_BUFFER_INVALID)
>             == ODP_TIMER_TMO_INVALID){
> -               ODP_DBG("Timeout request failed\n");
> +               LOG_DBG("Timeout request failed\n");
>                 return;
>         }
>
> @@ -87,7 +89,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
>                 tmo  = odp_timeout_from_buffer(buf);
>                 tick = odp_timeout_tick(tmo);
>
> -               ODP_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
> +               LOG_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
>
>                 odp_buffer_free(buf);
>
> @@ -131,7 +133,7 @@ static void *run_thread(void *ptr)
>         msg_pool = odp_buffer_pool_lookup("msg_pool");
>
>         if (msg_pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("  [%i] msg_pool not found\n", thr);
> +               LOG_ERR("  [%i] msg_pool not found\n", thr);
>                 return NULL;
>         }
>
> @@ -319,7 +321,7 @@ int main(int argc, char *argv[])
>                                       ODP_BUFFER_TYPE_TIMEOUT);
>
>         if (pool == ODP_BUFFER_POOL_INVALID) {
> -               ODP_ERR("Pool create failed.\n");
> +               LOG_ERR("Pool create failed.\n");
>                 return -1;
>         }
>
> @@ -334,7 +336,7 @@ int main(int argc, char *argv[])
>         queue = odp_queue_create("timer_queue", ODP_QUEUE_TYPE_SCHED, &param);
>
>         if (queue == ODP_QUEUE_INVALID) {
> -               ODP_ERR("Timer queue create failed.\n");
> +               LOG_ERR("Timer queue create failed.\n");
>                 return -1;
>         }
>
> @@ -344,7 +346,7 @@ int main(int argc, char *argv[])
>                                       args.max_us*ODP_TIME_USEC);
>
>         if (test_timer == ODP_TIMER_INVALID) {
> -               ODP_ERR("Timer create failed.\n");
> +               LOG_ERR("Timer create failed.\n");
>                 return -1;
>         }
>
> --
> 2.1.0
>



-- 
Mike Holmes
Linaro  Sr Technical Manager
LNG - ODP

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to