def _init(): global _logger _logger = logging.getLogger('wet') _handler = logging.FileHandler(get_data_path('log')) _formatter = logging.Formatter('[%(asctime)s]%(message)s', '%Y-%m-%d %H:%M:%S') _handler.setFormatter(_formatter) _logger.addHandler(_handler) _handler = logging.StreamHandler() _handler.setFormatter(_formatter) _logger.addHandler(_handler) _logger.setLevel(logging.DEBUG)
def init(): logger = logging.getLogger('wet') handler = logging.FileHandler(get_data_path('log')) formatter = logging.Formatter('[%(asctime)s] %(message)s', '%Y-%m-%d %H:%M:%S') handler.setFormatter(formatter) logger.addHandler(handler) handler = logging.StreamHandler() handler.setFormatter(formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG) log.logger = logger return logger