Check if logging is enabled at the given level. Use to avoid expensive string formatting when logging is disabled.