def __init__(self): general_func.dir_crt(log_main_dir) general_func.dir_crt(log_prj_dir) general_func.file_crt(log_main_file) self.logger = logging.getLogger("leechB") self.filehd = logging.FileHandler(log_main_file, "a+") self.streamhd = logging.StreamHandler() self.logger.setLevel("DEBUG") # 全局logger的level要低,下面不同handler才有效,否则以全局为主。
def __init__(self): # file/dir init general_func.dir_crt(prj_main_dir) general_func.file_crt(prj_main_cfg) general_func.dir_crt(prj_cfg_dir) # cfg init self.cfg = ConfigParser.ConfigParser() self.cfg.read(prj_main_cfg) # main log init self.prj_mng_log = logger.main_log() self.prj_mng_log.mainlog()
def __init__(self, prj_name): general_func.dir_crt(log_main_dir) general_func.dir_crt(log_prj_dir) general_func.file_crt(log_main_file) self.logger = logging.getLogger("snap_ctl_log") prj_snap_file = prj_cfg_dir + os.sep + prj_name general_func.file_crt(prj_snap_file) self.filehd = logging.FileHandler(prj_snap_file, "a+") self.streamhd = logging.StreamHandler() self.logger.setLevel("DEBUG") # 全局logger的level要低,下面不同handler才有效,否则以全局为主。