def __enter__(self):
import logging<EOL>if self._used:<EOL><INDENT>raise Exception("<STR_LIT>".format(self.__class__.__name__))<EOL><DEDENT>handler = logging.FileHandler(self.logfile, mode='<STR_LIT:w>')<EOL>handler.setLevel(self._level)<EOL>peppy.project._LOGGER.handlers.append(handler)<EOL>self._used = True<EOL>
Add the handler to project module's logger, and update state.