Browse Source

Refactor: All logging calls replaced with the new BS_LOG macro

BearishSun 6 years ago
parent
commit
a658d20dba

+ 2 - 0
Source/EditorCore/BsEditorPrerequisites.h

@@ -250,4 +250,6 @@ namespace bs
 		TID_SettingsValue = 40023,
 		TID_SettingsObjectValue = 40024
 	};
+
+	BS_LOG_CATEGORY(Editor, 60)
 }

+ 1 - 1
Source/EditorCore/Handles/BsHandleManager.cpp

@@ -39,7 +39,7 @@ namespace bs
 	{
 		if(!mInputStarted)
 		{
-			LOGWRN("Updating handle input without calling beginInput() first. Input won't be processed.");
+			BS_LOG(Warning, Editor, "Updating handle input without calling beginInput() first. Input won't be processed.");
 			return;
 		}
 

+ 5 - 4
Source/EditorCore/Library/BsProjectLibrary.cpp

@@ -157,7 +157,7 @@ namespace bs
 
 					if (!FileSystem::isFile(sourceFilePath))
 					{
-						LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
+						BS_LOG(Warning, Editor, "Found a .meta file without a corresponding resource. Deleting.");
 
 						FileSystem::remove(pathToSearch);
 					}
@@ -236,7 +236,7 @@ namespace bs
 
 							if(!FileSystem::isFile(sourceFilePath))
 							{
-								LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
+								BS_LOG(Warning, Editor, "Found a .meta file without a corresponding resource. Deleting.");
 
 								FileSystem::remove(filePath);
 							}
@@ -1136,7 +1136,8 @@ namespace bs
 		Path filePath = uuidToPath(resource.getUUID());
 		if(filePath.isEmpty())
 		{
-			LOGWRN("Trying to save a resource that hasn't been registered with the project library. Call ProjectLibrary::create first.");
+			BS_LOG(Warning, Editor, "Trying to save a resource that hasn't been registered with the project library. "
+				"Call ProjectLibrary::create first.");
 			return;
 		}
 
@@ -1194,7 +1195,7 @@ namespace bs
 		Path parentPath = newFullPath.getParent();
 		if (!FileSystem::isDirectory(parentPath))
 		{
-			LOGWRN("Move operation failed. Destination directory \"" + parentPath.toString() + "\" doesn't exist.");
+			BS_LOG(Warning, Editor, "Move operation failed. Destination directory \"{0}\" doesn't exist.", parentPath);
 			return;
 		}
 

+ 1 - 1
Source/EditorCore/Scene/BsScenePicking.cpp

@@ -215,7 +215,7 @@ namespace bs
 		encoded.a = 1.0f;
 
 		if (((index >> 24) & 0xFF))
-			LOGERR("Index when picking out of valid range.");
+			BS_LOG(Error, Editor, "Index when picking out of valid range.");
 
 		return encoded;
 	}

+ 4 - 4
Source/EditorScript/BsEditorResourceLoader.cpp

@@ -18,7 +18,7 @@ namespace bs
 		ProjectLibrary::FileEntry* resEntry = static_cast<ProjectLibrary::FileEntry*>(entry);
 		if (resEntry->meta == nullptr)
 		{
-			LOGWRN("Missing .meta file for resource at path: \"" + path.toString() + "\".");
+			BS_LOG(Warning, Editor, "Missing .meta file for resource at path: \"{0}\".", path);
 			return HResource();
 		}
 
@@ -26,14 +26,14 @@ namespace bs
 		// this could be optimized so only one of them is called.
 		SPtr<ProjectResourceMeta> meta = gProjectLibrary().findResourceMeta(path);
 		if (meta == nullptr)
-			LOGWRN("Unable to load resource at path: \"" + path.toString() + "\". File not found. ");
+			BS_LOG(Warning, Editor, "Unable to load resource at path: \"{0}\". File not found. ", path);
 
 		UUID resUUID = meta->getUUID();
 
 		if (resEntry->meta->getIncludeInBuild())
 		{
-			LOGWRN("Dynamically loading a resource at path: \"" + path.toString() + "\" but the resource \
-					isn't flagged to be included in the build. It may not be available outside of the editor.");
+			BS_LOG(Warning, Editor, "Dynamically loading a resource at path: \"{0}\" but the resource isn't flagged to "
+				"be included in the build. It may not be available outside of the editor.", path);
 		}
 
 		return gResources().loadFromUUID(resUUID, async, flags);

+ 6 - 4
Source/EditorScript/BsManagedEditorCommand.cpp

@@ -23,8 +23,8 @@ namespace bs
 
 		if(!ScriptAssemblyManager::instance().hasSerializableObjectInfo(mNamespace, mType))
 		{
-			LOGWRN("UndoableCommand created without [SerializeObject] attribute. The command will not be able to \
-				persist assembly refresh.");
+			BS_LOG(Warning, Editor, "UndoableCommand created without [SerializeObject] attribute. The command will not be "
+				"able to persist assembly refresh.");
 		}
 
 		mManagedCommand = bs_shared_ptr(new (bs_alloc<CmdManaged>()) CmdManaged(this));
@@ -208,7 +208,8 @@ namespace bs
 	{
 		if(mScriptObj == nullptr)
 		{
-			LOGWRN("Trying to execute a managed undo/redo command whose managed object has been destroyed, ignoring.");
+			BS_LOG(Warning, Editor, "Trying to execute a managed undo/redo command whose managed object has been "
+				"destroyed, ignoring.");
 			// Note: This can most likely happen if managed undo commands are queued on a global undo/redo stack. When
 			// assembly refresh happens those commands will be rebuilt, but this can fail if the user removed the command
 			// type from the assembly, or the command isn't serializable.
@@ -223,7 +224,8 @@ namespace bs
 	{
 		if (mScriptObj == nullptr)
 		{
-			LOGWRN("Trying to execute a managed undo/redo command whose managed object has been destroyed, ignoring.");
+			BS_LOG(Warning, Editor, "Trying to execute a managed undo/redo command whose managed object has been "
+				"destroyed, ignoring.");
 			// Note: This can most likely happen if managed undo commands are queued on a global undo/redo stack. When
 			// assembly refresh happens those commands will be rebuilt, but this can fail if the user removed the command
 			// type from the assembly, or the command isn't serializable.

+ 3 - 3
Source/EditorScript/Wrappers/BsScriptBuildManager.cpp

@@ -234,7 +234,7 @@ namespace bs
 		{
 			if (entry->meta == nullptr)
 			{
-				LOGWRN("Cannot include resource in build, missing meta file for: " + entry->path.toString());
+				BS_LOG(Warning, Editor, "Cannot include resource in build, missing meta file for: {0}", entry->path);
 				continue;
 			}
 
@@ -245,7 +245,7 @@ namespace bs
 				if (gResources().getFilePathFromUUID(resMeta->getUUID(), resourcePath))
 					usedResources.insert(resourcePath);
 				else
-					LOGWRN("Cannot include resource in build, missing imported asset for: " + entry->path.toString());
+					BS_LOG(Warning, Editor, "Cannot include resource in build, missing imported asset for: {0}", entry->path);
 			}
 		}
 
@@ -261,7 +261,7 @@ namespace bs
 			if (gResources().getFilePathFromUUID(platformInfo->mainScene.getUUID(), resourcePath))
 				usedResources.insert(resourcePath);
 			else
-				LOGWRN("Cannot include main scene in build, missing imported asset.");
+				BS_LOG(Warning, Editor, "Cannot include main scene in build, missing imported asset.");
 		}
 
 		// Find dependencies of all resources

+ 2 - 2
Source/EditorScript/Wrappers/BsScriptEditorSettings.cpp

@@ -353,8 +353,8 @@ namespace bs
 			const ReflectableTypeInfo* reflTypeInfo = ScriptAssemblyManager::instance().getReflectableTypeInfo(rttiId);
 			if(reflTypeInfo == nullptr)
 			{
-				LOGERR(StringUtil::format("Mapping between a reflectable object and a managed type is missing "
-					"for type \"{0}\"", rttiId))
+				BS_LOG(Error, Script,"Mapping between a reflectable object and a managed type is missing "
+					"for type \"{0}\"", rttiId);
 				return nullptr;
 			}
 

+ 2 - 2
Source/EditorScript/Wrappers/BsScriptProjectLibrary.cpp

@@ -473,8 +473,8 @@ namespace bs
 			const ReflectableTypeInfo* reflTypeInfo = ScriptAssemblyManager::instance().getReflectableTypeInfo(rttiId);
 			if(reflTypeInfo == nullptr)
 			{
-				LOGERR(StringUtil::format("Mapping between a reflectable object and a managed type is missing "
-					"for type \"{0}\"", rttiId))
+				BS_LOG(Error, Script,"Mapping between a reflectable object and a managed type is missing "
+					"for type \"{0}\"", rttiId);
 				return nullptr;
 			}
 

+ 2 - 2
Source/EditorScript/Wrappers/BsScriptProjectSettings.cpp

@@ -168,8 +168,8 @@ namespace bs
 			const ReflectableTypeInfo* reflTypeInfo = ScriptAssemblyManager::instance().getReflectableTypeInfo(rttiId);
 			if(reflTypeInfo == nullptr)
 			{
-				LOGERR(StringUtil::format("Mapping between a reflectable object and a managed type is missing "
-					"for type \"{0}\"", rttiId))
+				BS_LOG(Error, Script,"Mapping between a reflectable object and a managed type is missing "
+					"for type \"{0}\"", rttiId);
 				return nullptr;
 			}
 

+ 3 - 3
Source/EditorScript/Wrappers/BsScriptSerializedObject.cpp

@@ -68,9 +68,9 @@ namespace bs
 				const ReflectableTypeInfo* reflTypeInfo = ScriptAssemblyManager::instance().getReflectableTypeInfo(rttiId);
 				if (reflTypeInfo == nullptr)
 				{
-					LOGERR(StringUtil::format("Mapping between a reflectable object and a managed type is missing "
-						"for type \"{0}\"", rttiId))
-						return nullptr;
+					BS_LOG(Error, Script, "Mapping between a reflectable object and a managed type is missing "
+						"for type \"{0}\"", rttiId);
+					return nullptr;
 				}
 
 				return reflTypeInfo->createCallback(obj);

+ 2 - 2
Source/EditorScript/Wrappers/BsScriptUndoRedo.cpp

@@ -219,14 +219,14 @@ namespace bs
 			bool isManagedComponent = MonoUtil::isSubClassOf(requestedClass, managedComponent->_getInternalClass());
 			if (isManagedComponent)
 			{
-				LOGWRN("Only built-in components can be added though this method.");
+				BS_LOG(Warning, Editor, "Only built-in components can be added though this method.");
 				continue;
 			}
 
 			BuiltinComponentInfo* info = sam.getBuiltinComponentInfo(paramType);
 			if (info == nullptr)
 			{
-				LOGWRN("Provided type is not a valid component")
+				BS_LOG(Warning, Editor, "Provided type is not a valid component")
 				continue;
 			}
 

+ 1 - 1
Source/bsf

@@ -1 +1 @@
-Subproject commit 39f2b023c3811a0f61027bc2ea1c11324280d620
+Subproject commit c7d918d47e830cf5e7181e3d7d7078ace5e3cbac