aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel.h
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/squirrel.h')
-rw-r--r--NorthstarDLL/squirrel.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel.h
index 65dd66c5..a1f1dd5f 100644
--- a/NorthstarDLL/squirrel.h
+++ b/NorthstarDLL/squirrel.h
@@ -3,6 +3,7 @@
#include "squirrelclasstypes.h"
#include "squirrelautobind.h"
#include "vector.h"
+#include "logging.h"
// stolen from ttf2sdk: sqvm types
typedef float SQFloat;
@@ -36,6 +37,13 @@ const char* GetContextName_Short(ScriptContext context);
eSQReturnType SQReturnTypeFromString(const char* pReturnType);
const char* SQTypeNameFromID(const int iTypeId);
+std::shared_ptr<ColoredLogger> getSquirrelLoggerByContext(ScriptContext context);
+
+namespace NS::log
+{
+ template <ScriptContext context> std::shared_ptr<spdlog::logger> squirrel_logger();
+}; // namespace NS::log
+
void schedule_call_external(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function);
// This base class means that only the templated functions have to be rebuilt for each template instance
@@ -297,6 +305,7 @@ template <ScriptContext context> class SquirrelManager : public virtual Squirrel
int result = sq_getfunction(m_pSQVM->sqvm, funcname, &functionobj, 0);
if (result != 0) // This func returns 0 on success for some reason
{
+ NS::log::squirrel_logger<context>()->error("Call was unable to find function with name '{}'. Is it global?", funcname);
return SQRESULT_ERROR;
}
pushobject(m_pSQVM->sqvm, &functionobj); // Push the function object
@@ -319,6 +328,7 @@ template <ScriptContext context> class SquirrelManager : public virtual Squirrel
int result = sq_getfunction(m_pSQVM->sqvm, funcname, &functionobj, 0);
if (result != 0) // This func returns 0 on success for some reason
{
+ NS::log::squirrel_logger<context>()->error("Call was unable to find function with name '{}'. Is it global?", funcname);
return SQRESULT_ERROR;
}
pushobject(m_pSQVM->sqvm, &functionobj); // Push the function object