code optimization on logger