MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / logLevelTest

Function logLevelTest

integrationTest/main.cc:307–342  ·  view source on GitHub ↗

Test all log levels and make sure that the logs are correctly omitted.

Source from the content-addressed store, hash-verified

305
306// Test all log levels and make sure that the logs are correctly omitted.
307void logLevelTest() {
308 LogLevel startingLevel = NanoLog::getLogLevel();
309
310 NanoLog::setLogLevel(DEBUG);
311 NANO_LOG(DEBUG, "Debug");
312 NANO_LOG(NOTICE, "Notice");
313 NANO_LOG(WARNING, "Warning");
314 NANO_LOG(ERROR, "Error");
315
316 NanoLog::setLogLevel(NOTICE);
317 NANO_LOG(DEBUG, "Debug");
318 NANO_LOG(NOTICE, "Notice");
319 NANO_LOG(WARNING, "Warning");
320 NANO_LOG(ERROR, "Error");
321
322 NanoLog::setLogLevel(WARNING);
323 NANO_LOG(DEBUG, "Debug");
324 NANO_LOG(NOTICE, "Notice");
325 NANO_LOG(WARNING, "Warning");
326 NANO_LOG(ERROR, "Error");
327
328 NanoLog::setLogLevel(ERROR);
329 NANO_LOG(DEBUG, "Debug");
330 NANO_LOG(NOTICE, "Notice");
331 NANO_LOG(WARNING, "Warning");
332 NANO_LOG(ERROR, "Error");
333
334 NanoLog::setLogLevel(SILENT_LOG_LEVEL);
335 NANO_LOG(DEBUG, "Debug");
336 NANO_LOG(NOTICE, "Notice");
337 NANO_LOG(WARNING, "Warning");
338 NANO_LOG(ERROR, "Error");
339
340 // Restoring the previous log level
341 NanoLog::setLogLevel(startingLevel);
342}
343
344// Test all possible specifiers (except %n) from
345// http://www.cplusplus.com/reference/cstdio/printf/ (3/20/18)

Callers 1

mainFunction · 0.85

Calls 3

getLogLevelFunction · 0.85
setLogLevelFunction · 0.85
NANO_LOGClass · 0.85

Tested by

no test coverage detected