import logging
logging.basicConfig(
    filename='example.log', 
    encoding='utf-8', 
    level=logging.DEBUG, 
    format='%(asctime)s: %(levelname)s: %(message)s'
)

def write(msg, type="info"):

    if type == "info":
        logging.info(msg)