Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Log Test directly with level


#1

Hello,

is there an easier way to generate messages according to the level like this:

switch(lvl)
{
	case lvDebug:
        SiMain->LogDebug(buffer);
    break;
	case lvVerbose:
        SiMain->LogVerbose(buffer);
    break;
	case lvMessage:
        SiMain->LogMessage(buffer);
    break;
	case lvWarning:
        SiMain->LogWarning(buffer);
    break;
	case lvError:
        SiMain->LogError(buffer);
    break;
	case lvFatal:
        SiMain->LogFatal(buffer);
    break;
    default:
	SiMain->LogMessage(buffer);
}

I searched for such a function but found nothing. LogText() only uses the level to filter in dependency of log level.

Regards

Peter


#2

Hello Peter,

that’s currently the only way to do this. The reason for this is that the log level (lvDebug etc.) and log entry types (which are used for displaying the icons in the Console and deciding whether a log entry is a EnterMethod or LeaveMethod log entry, for example) are two different concepts. The log level is for application-side filtering whereas the log entry type is used in the Console. This is a bit confusing, I know, and one of the bigger features that are waiting on our todo list is to improve the log level handling and integrating it better into the Console.