import logging
import sys
logger = logging.getLogger()
logger.setLevel(logging.INFO)
rf_handler = logging.StreamHandler(sys.stderr)
rf_handler.setLevel(logging.DEBUG)
rf_handler.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s %(message)s"))
f_handler = logging.FileHandler('log_path\\logs.log')
f_handler.setLevel(logging.INFO)
f_handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s - %(filename)s[:%(lineno)d]"))
logger.addHandler(rf_handler)
logger.addHandler(f_handler)
logger.debug('debug messages')
logger.info('info messages')
logger.warning('warning messages')
logger.error('error messages')
logger.critical('critical messages')