Hi!

ocpayload.h has become part of the CSDK external API. As such, I think
it's important that logging stuff be kept out of it.

ocpayload.h must not pull in logger.h, because that starts to pull in
most of the logging infrastructure. This has been avoided in ocstack.h
and octypes.h, making for a pretty clean separation between public API
and facilities internal to the stack.

One of the problems with pulling in the logging headers is that the
log levels are stored in an enum, and one of them is called "DEBUG".
This is bad, because, at least in the case of node addons, compiling
against these headers in debug mode results in DEBUG being defined as
an empty macro (gcc -DDEBUG...), which, in turn, results in a syntax
error during compilation, because

typedef enum {
  DEBUG = 0,
  INFO,
  ...
} LogLevel;

becomes

typedef enum {
   = 0,
  INFO,
  ...
} LogLevel;

after preprocessing.

Ideally, the logging functionality included in ocpayload.h should be
moved to a separate file, thus restricting the scope of ocpayload.h to
that of exposing the payload construction/parsing/destruction API.
This would help keep the clean separation between public API and
internal facilities.

HTH,



Gabriel

Reply via email to