KeywordLogger Pass/Fail counts?

I have a test case in which I want to do multiple validations and output pass/fail information for each one so that I can see the results in TestOps. The best way I’ve found for this it using KeywordLogger

KeywordLogger log = new KeywordLogger()
log.logFailed(‘Something went wrong’)
log.logFailed(‘A second failure’)

What I’d like to do next is fail the overall test case if there were one or more failed validations. Is there a simple way to get a count of the failed log messages (log.getFailCount), so that if I’ve logged any failures I can then use something like WS.verifyEqual(true, false) to make the test case show as failed?

Aha! Found a solution which works perfectly for me. Instead of using KeywordLogger directly, import com.kms.katalon.core.util.KeywordUtil and use the markPassed and markFailed methods…

KeywordUtil.markFailed(‘Something went wrong’)
KeywordUtil.markFailed(‘A second failure’)
KeywordUtil.markFailed(‘A third failure’)