MCPcopy Create free account
hub / github.com/MEONMedical/Log4Qt / testBinaryEventFilter

Method testBinaryEventFilter

tests/binaryloggertest/binaryloggertest.cpp:195–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void BinaryLoggerTest::testBinaryEventFilter()
196{
197 auto blogger = Log4Qt::Logger::rootLogger();
198 Log4Qt::Filter *denyall = new Log4Qt::DenyAllFilter;
199 denyall->activateOptions();
200
201 auto *binfilter = new Log4Qt::BinaryEventFilter(blogger);
202
203 binfilter->setAcceptBinaryEvents(true);
204 binfilter->setNext(Log4Qt::FilterSharedPtr(denyall));
205 binfilter->activateOptions();
206
207 mAppender->addFilter(Log4Qt::FilterSharedPtr(binfilter));
208
209 auto _ = createScopeExitGuard([this, binfilter] {mAppender->removeEventFilter(binfilter);});
210
211 log("Hello world!");
212 auto list = mAppender->clearList();
213 QCOMPARE(list.size(), 1);
214 QVERIFY(list.at(0).contains("12 bytes: 48 65 6c 6c 6f 20 77 6f 72 6c 64 21"));
215
216 binfilter->setAcceptBinaryEvents(false);
217
218 log("Hello world!");
219 QVERIFY(mAppender->clearList().isEmpty());
220
221}
222
223void BinaryLoggerTest::testBinaryWriterAppender()
224{

Callers

nothing calls this directly

Calls 8

createScopeExitGuardFunction · 0.85
logFunction · 0.85
setAcceptBinaryEventsMethod · 0.80
setNextMethod · 0.80
addFilterMethod · 0.80
isEmptyMethod · 0.80
activateOptionsMethod · 0.45
clearListMethod · 0.45

Tested by

no test coverage detected