Skip to content

Can't easily use tracing when building OpENer as library. #547

@MaxjATL

Description

@MaxjATL

Hi there, I have ran into a bit of an issue with trying to use tracing when building OpENer as a library.

When building as a library trace.h will not include "opener_user_conf.h"

#ifndef OPENER_INSTALL_AS_LIB
#include "opener_user_conf.h"
#endif

However this is where the definition for LOG_TRACE is provided. So if you build it as a library and try and turn tracing on by defining OPENER_TRACE_ENABLED it will fail to compile.

I understand LOG_TRACE is likely provided in openuser_conf.h as it allows users to extend the functionality of the trace macro if they so desire.

My suggestion is that that trace.h contains a default definition of #define LOG_TRACE(...) fprintf(stderr,VA_ARGS) that is wrapped inside of an #ifndef LOG_TRACE to still allow user definition. Much the same as how OPENER_TRACE_LEVEL has been handled.

/* Defines a default trace function if the user hasn't provided one */
#ifndef LOG_TRACE
#include <stdio.h>
#define LOG_TRACE(...)  fprintf(stderr,__VA_ARGS__)
#endif

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions