def debug_log_contents(): fs = filesystem.RealFilesystem() return "\n".join([ debug_string_for_file(settings.settings_file_path('config.txt', fs)), debug_string_for_file(settings.settings_file_path('consoles.txt', fs)), debug_string_for_file(settings.settings_file_path('emulators.txt', fs)), debug_string_for_file(paths.log_file_location()), ]) return log_file_contents()
def create_file_handler(level): path = paths.log_file_location() # Since the logger is created so early in Ice's lifecycle (import time) # its possible that the application_data_directory (where the log file # is stored) doesnt exist. Create it now directory = os.path.dirname(path) if not os.path.exists(directory): os.makedirs(directory) # logfile handler (print all messages to logfile) # - max file size of 1mb # - log file is stored in `log_file_location` (which is inside application_data_dir) fh = logging.handlers.RotatingFileHandler(filename=path, maxBytes=1048576, backupCount=5) fh.setLevel(level) fh.setFormatter(logging.Formatter(FILE_STRING_FORMAT)) return fh
def create_file_handler(level): path = paths.log_file_location() # Since the logger is created so early in Ice's lifecycle (literally one of # the first things, since it happens at import time) its possible that the # application_data_directory (where the log file is stored) doesnt exist. # Create it now directory = os.path.dirname(path) if not os.path.exists(directory): os.makedirs(directory) # logfile handler (print all messages to logfile) # - max file size of 1mb # - log file is stored in `log_file_location` (which is inside application_data_dir) fh = logging.handlers.RotatingFileHandler( filename=path, maxBytes=1048576, backupCount=5) fh.setLevel(level) fh.setFormatter(logging.Formatter(FILE_STRING_FORMAT)) return fh