@@ -92,7 +92,10 @@ def __init__(self, engine="sqlite", connect_to_translated_db=False) -> None:
9292 else :
9393 self .engine = create_database_engine (engine , self ._sqlite_folder_path )
9494
95- print (
95+ log .info (
96+ "\n ==================================================\n "
97+ "---------> open-MaStR started <---------\n "
98+ "==================================================\n "
9699 f"Data will be written to the following database: { self .engine .url } \n "
97100 "If you run into problems, try to "
98101 "delete the database and update the package by running "
@@ -239,7 +242,7 @@ def download(
239242
240243 download_xml_Mastr (zipped_xml_file_path , date , data , xml_folder_path )
241244
242- print (
245+ log . info (
243246 "\n Would you like to speed up the creation of your MaStR database?\n "
244247 "Try our new parallelized processing by setting os.environ['USE_RECOMMENDED_NUMBER_OF_PROCESSES'] = True "
245248 "or configure your own number of processes via os.environ['NUMBER_OF_PROCESSES'] = your_number\n "
@@ -259,8 +262,8 @@ def download(
259262 # Set api_processes to None in order to avoid the malfunctioning usage
260263 if api_processes :
261264 api_processes = None
262- print (
263- "Warning: The implementation of parallel processes "
265+ log . warning (
266+ "The implementation of parallel processes "
264267 "is currently under construction. Please let "
265268 "the argument api_processes at the default value None."
266269 )
@@ -429,9 +432,11 @@ def translate(self) -> None:
429432 try :
430433 os .remove (new_path )
431434 except Exception as e :
432- print (f"An error occurred: { e } " )
435+ log .error (
436+ f"An error occurred while removing old translated database: { e } "
437+ )
433438
434- print ("Replacing previous version of the translated database..." )
439+ log . info ("Replacing previous version of the translated database..." )
435440
436441 for table in inspector .get_table_names ():
437442 rename_table (table , inspector .get_columns (table ), self .engine )
@@ -440,9 +445,9 @@ def translate(self) -> None:
440445
441446 try :
442447 os .rename (old_path , new_path )
443- print (f"Database '{ old_path } ' changed to '{ new_path } '" )
448+ log . info (f"Database '{ old_path } ' changed to '{ new_path } '" )
444449 except Exception as e :
445- print (f"An error occurred: { e } " )
450+ log . error (f"An error occurred while renaming database : { e } " )
446451
447452 self .engine = create_engine (f"sqlite:///{ new_path } " )
448453 self .is_translated = True
0 commit comments