improve log handler