Logging custom structure using WPP

52 Views Asked by At

I'm trying to use WPP to log my own struct. struct is:

struct A
{
int a;
int b;
}

I added localwpp.ini file to configuration and defined:

DEFINE_CPLX_TYPE(MYSTRUCTA, WPP_LOGWMYSTRUCTA, MYSTRUCTA, ItemLong,"d", x, 0, 1);

then i defined new macro in log.h:

#define WPP_LOGWMYSTRUCTA(x) WPP_LOGTYPEVAL(A, x)

And in my source code:

A x;
LOG(INFO, "%!MYSTRUCTA!", x);

Above is just a template. I was trying a lot of versions of that

My gould would be:

DEFINE_CPLX_TYPE(MYSTRUCTA, WPP_LOGWMYSTRUCTA, MYSTRUCTA, ItemListLong,"a:%d b:%d", x, 0, 2);

But then i can see in collected logs some random numbers. differs by 14. In TMF file i can see that generated function will receive just one argument:

    L"{", \
    L"x, ItemListLong -- 10" , \
    L"}")

How can I log custom struct in my custom way using WPP? is ItemListLong proper typy for such a solution? i checked also defaultwpp.ini file. I can see there a lot of DEFINE_FLAVOR. What does it mean? I could't fine defeinition.

I tried with various types of args. I tried also somehow combine macro like DEFINE_CPLX_TYPE(MYSTRUCTA, WPP_LOGWMYSTRUCTA, MYSTRUCTA, ItemListLong,"d!/%11!d", x, 0, 2); basing on output tmf file to be aligned with expected pattern:

    L" 173 \"%0 %10!d!/%11!d!\" //   FLAGS=TRACE_FLAG_GENERAL LEVEL=INFO" \

But then second parameter is 0.

0

There are 0 best solutions below