Browse Source

Add a log entry for importing, duplicating or removing a material

We encountered an issue yesterday that we had to find in a log file when a user was importing a material. Nothing is shown in the log when importing a material, so it was impossible to find.
Now we'll log this action. It is a direct user action, so info is a good log level.
Ghostkeeper 3 years ago
parent
commit
2f8f98fcca

+ 3 - 1
cura/Machines/Models/MaterialManagementModel.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Ultimaker B.V.
+# Copyright (c) 2021 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import copy  # To duplicate materials.
@@ -79,6 +79,7 @@ class MaterialManagementModel(QObject):
 
         :param material_node: The material to remove.
         """
+        Logger.info(f"Removing material {material_node.container_id}")
 
         container_registry = CuraContainerRegistry.getInstance()
         materials_this_base_file = container_registry.findContainersMetadata(base_file = material_node.base_file)
@@ -194,6 +195,7 @@ class MaterialManagementModel(QObject):
 
         :return: The root material ID of the duplicate material.
         """
+        Logger.info(f"Duplicating material {material_node.base_file} to {new_base_id}")
         return self.duplicateMaterialByBaseFile(material_node.base_file, new_base_id, new_metadata)
 
     @pyqtSlot(result = str)

+ 2 - 1
cura/Settings/ContainerManager.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Ultimaker B.V.
+# Copyright (c) 2021 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import os
@@ -241,6 +241,7 @@ class ContainerManager(QObject):
             file_url = file_url_or_string.toLocalFile()
         else:
             file_url = file_url_or_string
+        Logger.info(f"Importing material from {file_url}")
 
         if not file_url or not os.path.exists(file_url):
             return {"status": "error", "message": "Invalid path"}