import logging
import traceback

class Mylog:

    def __init__(self,log_name,log_level):
        self.name=log_name
        self.level=log_level
    
    def logcfg(self):
        if len(self.level) > 0:
            if self.level == 'debug':
                Level=logging.DEBUG
            elif self.level == 'info':
                Level=logging.INFO
            elif self.level == 'warning':
                Level=logging.WARNING
            else:
                Level=logging.ERROR
        logging.basicConfig(filename=r'D:\Develop\User\Songpengfei\data_analyze_platform\WORK\101log\\'+self.name, level=Level,format='%(asctime)s - %(levelname)s - %(message)s')


    def logopt(self,*info):
        logging.error(info)
        logging.error(traceback.format_exc())
