def compile_readme(output_filename='output/LoG', **kw): ''' Compile a "2_readme.md" file''' log_obj = BESTLOG(os.path.join(cd, output_filename)) main(logger=log_obj, insert_md_section_for__class_methods= insert_md_section_for__class_methods, remove_repeated_sections_classmethods= remove_repeated_sections_classmethods, files_to_include=[0, 1, 2, 3], output_name=README_OFILENAME, delete_html_comments=True) log_obj.save() return log_obj.load(**kw)
def compile_call_ref(output_filename='output/LoG_call_ref', **kw): ''' Compile a "5_call_reference.md" file''' log_obj = BESTLOG(os.path.join(cd, output_filename)) main(logger=log_obj, main_md_file='markdown input files/5_call_reference.md', insert_md_section_for__class_methods= insert_md_section_for__class_methods, remove_repeated_sections_classmethods= remove_repeated_sections_classmethods, files_to_include=[], output_name=CALL_REFERENCE_OFILENAME, delete_html_comments=True) log_obj.save() return log_obj.load(**kw)
def compile_all_stuff(**kw): # import logging log_file = os.path.join(cd, 'LoG') log_obj = BESTLOG(log_file) main(logger=log_obj, insert_md_section_for__class_methods= insert_md_section_for__class_methods, remove_repeated_sections_classmethods= remove_repeated_sections_classmethods, files_to_include=[0, 1, 2, 3], output_name=OUTPUT_FILENAME, delete_html_comments=True) log_obj.save() # cd = CD = os.path.dirname(os.path.abspath(__file__)) # log_file = os.path.join(cd, 'usage.log.txt') return log_obj.load(**kw)
insert_md_section_for__class_methods = False remove_repeated_sections_classmethods = False ############## # __ # # /_ | # # | | # # | | # # | | # # |_| # ############## if method == 'simple, no log': main(logger=None, insert_md_section_for__class_methods= insert_md_section_for__class_methods, remove_repeated_sections_classmethods= remove_repeated_sections_classmethods, files_to_include=[0, 1, 2, 3], output_name=OUTPUT_FILENAME, delete_html_comments=True) ################ # ___ # # |__ \ # # ) | # # / / # # / /_ # # |____| # ################ class BESTLOG(object): def __init__(self, filename):
logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) a_log_file = logging.FileHandler('_logs.txt', mode='w') a_log_file.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s>%(levelname)s: %(message)s') a_log_file.setFormatter(formatter) logger.addHandler(a_log_file) # 2### files to compile files = [0, 1, 2, 3] if values['all-checkbox'] else [] if not values['all-checkbox']: if values['file1']: files.append(1) if values['file2']: files.append(2) if values['file3']: files.append(3) if values['file4']: files.append(4) # 3### REAL work: mk_readme.main(logger=logger, files_to_include=files, output_name=values['output_name'], delete_html_comments=True) # MAIN WORK - END for i in readfile('_logs.txt').split('\n'): if i.endswith('--> - COMPLETE'): window['COMPLETE'](values['COMPLETE'] + [i]) else: window['NOTCOMPLETE'](values['COMPLETE'] + [i]) if enable_logs: window['logs'](values['logs'] + output_readme) window.close()
method = 'simple, no log' # method = 'with logs' ############## # __ # # /_ | # # | | # # | | # # | | # # |_| # # # # # ############## if method == 'simple, no log': main(logger=None, files_to_include=[0, 1, 2, 3], output_name='This_is_FINAL_readme.md', delete_html_comments=True) ################ # ___ # # |__ \ # # ) | # # / / # # / /_ # # |____| # # # # # ################ if method == 'with logs': import logging