check debug flag before logging at LogLevel == DEBUG