def setup_file_logging(log_filename, log_file_level="<STR_LIT>", str_format=None,<EOL>date_format=None, log_restart=False, log_history=False,<EOL>formatter=None, silence_modules=None, log_filter=None):
from seaborn_timestamp.timestamp import datetime_to_str<EOL>if os.path.exists(log_filename) and log_restart:<EOL><INDENT>os.remove(log_filename)<EOL><DEDENT>add_file_handler(log_file_level, log_filename, str_format=str_format,<EOL>date_format=date_format, formatter=formatter,<EOL>log_filter=log_filter)<EOL>if log_history:<EOL><INDENT>base_name = os.path.basename(log_filename).split('<STR_LIT:.>')[<NUM_LIT:0>] +'<STR_LIT>' % datetime_to_str(str_format='<STR_LIT>')<EOL>history_log = os.path.join(os.path.dirname(log_filename),<EOL>'<STR_LIT>', base_name + '<STR_LIT>')<EOL>add_file_handler(log_file_level, history_log, str_format=str_format,<EOL>date_format=date_format, log_filter=log_filter)<EOL><DEDENT>silence_module_logging(silence_modules)<EOL>
This will setup logging for a single file but can be called more than once
LOG LEVELS are "CRITICAL", "ERROR", "INFO", "DEBUG"
:param log_filename:    str of the file location
:param log_file_level   str of the log level to use on this file
:param str_format:      str of the logging format
:param date_format:     str of the date format
:param log_restart:     bool if True the log file will be deleted first
:param log_history:     bool if True will save another log file in a folder
                        called history with the datetime
:param formatter:       logging.Format instance to use
:param log_filter:      logging.filter instance to add to handler
:param silence_modules  list of str of modules to silence
:return:                None