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

LogConditional - Feature request


#1

Hi there,

Would it be possible to add a ‘LogConditional’ logmethod to the SmartInspect api. I often find I want to log stuff only under certain conditions and using the ‘LogAssert’ method doesn’t quite cover this functionallity because of the error icon.

Regards,
Gerben


#2

Thanks for the suggestion, Gerben. It indeed looks useful and I think we will add it to a future release.

I’m a bit unsure about the implementation, though. Maybe it would be better to add overloaded variants for the existing LogDebug, LogVerbose, LogMessage, LogWarning and LogError methods with an additional ‘condition’ argument instead of a LogConditional method. What do you think?


#3

Either that or just add the ‘loglevel’ parameter to the ‘LogConditional’ method.

An advantage of a separate ‘LogConditional’ function might be that it would allow for a single icon regardless of the loglevel, wheras the addition of a ‘condition’ var to the ‘LogDebug’ etc. functions would hide the fact that is was a conditional logging event.

Regards,


#4

Yes, ok, under this aspect a dedicated LogConditional method with a new Conditional log entry type (for filtering in the Console) would probably be better. I added it to the feature request list. Thanks again for the idea!