Add more contextual log printing on missing object/asset reference

#2414
This commit is contained in:
Wojtek Figat
2024-09-15 23:03:53 +02:00
parent 1fa0159079
commit a367d40913
6 changed files with 74 additions and 15 deletions

View File

@@ -727,7 +727,10 @@ DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_FindObject(Guid* id, MTypeObject*
if (klass && !obj->Is(klass))
{
if (!skipLog)
LOG(Warning, "Found scripting object with ID={0} of type {1} that doesn't match type {2}. {3}", *id, String(obj->GetType().Fullname), String(klass->GetFullName()), LogContext::GetInfo());
{
LOG(Warning, "Found scripting object with ID={0} of type {1} that doesn't match type {2}", *id, String(obj->GetType().Fullname), String(klass->GetFullName()));
LogContext::Print(LogType::Warning);
}
return nullptr;
}
return obj->GetOrCreateManagedInstance();
@@ -736,9 +739,10 @@ DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_FindObject(Guid* id, MTypeObject*
if (!skipLog)
{
if (klass)
LOG(Warning, "Unable to find scripting object with ID={0}. Required type {1}. {2}", *id, String(klass->GetFullName()), LogContext::GetInfo());
LOG(Warning, "Unable to find scripting object with ID={0} of type {1}", *id, String(klass->GetFullName()));
else
LOG(Warning, "Unable to find scripting object with ID={0}", *id);
LogContext::Print(LogType::Warning);
}
return nullptr;
}