-
Notifications
You must be signed in to change notification settings - Fork 17
Labels
conclusion: resolvedIssue was resolvedIssue was resolvedtopic: codeRelated to content of the project itselfRelated to content of the project itselftype: enhancementProposed improvementProposed improvement
Description
At times, it can be helpful to print the current debug level to the serial monitor as a string. I've implemented this in my own code, but it could be helpful to include in the library to be accessible to all...
// Enum to String Inline Function
//----------------------------------------------------------------------------
// * Translates enum value to a printable string
// * enums are mapped to strings by order in list
// * use static inline keywords to allow function definition in .h file
static inline char* debugLevelToString(int debugLevel)
{
char* str[] =
{
"DBG_NONE",
"DBG_ERROR",
"DBG_WARNING",
"DBG_INFO",
"DBG_DEBUG",
"DBG_VERBOSE"
};
return str[debugLevel+1]; // DBG_NONE assigned to -1, so add 1 for correct output string
}
Metadata
Metadata
Assignees
Labels
conclusion: resolvedIssue was resolvedIssue was resolvedtopic: codeRelated to content of the project itselfRelated to content of the project itselftype: enhancementProposed improvementProposed improvement