support efficient toggle in logging