Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call remote debug with a single statement #18

Closed
gmag11 opened this issue Sep 11, 2017 · 2 comments
Closed

Call remote debug with a single statement #18

gmag11 opened this issue Sep 11, 2017 · 2 comments

Comments

@gmag11
Copy link

gmag11 commented Sep 11, 2017

Using if ( Debug.isActive( .. ) ) is a bit annoying if you have lots of debug messages.

Using a function like

Debug.printf( debugLevel , "Some string with some format place holders %d %s", some, variables );

code would be cleaner.

it could be implemented as

size_t RemoteDebug::printf (uint8_t debugLevel, const char* format , ...) {
    if (isActive (debugLevel)) {
        va_list argptr;
        va_start (argptr, format);
        printf (format, argptr);
        va_end (argptr);
    } 
}

Do you agree?

@JoaoLopesF
Copy link
Owner

Hi, is a good suggestion. I make any tests with it and publish it soon

Thanks a lot

Joao

@JoaoLopesF
Copy link
Owner

Hi

I have now released a new version with something similar to your idea.

The RemoteDebug should be with isActive because this has a smaller overhead.

But now we have shortcuts:

DEBUG ("This is any any (always showed) - var% d \ n", var);
DEBUG_V ("This is a message of debug level VERBOSE \ n");
DEBUG_D ("This is a message of debug level DEBUG \ n");
DEBUG_I ("This is a message of debug level INFO \ n");
DEBUG_W ("This is a message of debug level WARNING \ n");
DEBUG_E ("This is a message of debug level ERROR \ n");

I hope you enjoy

thankful
Joao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants