python log error in log file code example
Example: from logging import logger
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
logger.debug('Loging %s lewel', 'DEBUG')
logger.info('Loging %s lewel', 'INFO')
logger.warning('Loging %s lewel', 'WARN')
logger.error('Loging %s lewel', 'ERROR')
logger.critical('Loging %s lewel', 'CRITICAL')