Replace commented-out log statements with optional logging.