main.cpp: check log level range before using its value