aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NorthstarDedicatedTest/logging.cpp16
-rw-r--r--NorthstarDedicatedTest/squirrel.h4
2 files changed, 14 insertions, 6 deletions
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index dbfc292e..66f2de4c 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -1,11 +1,10 @@
#include "pch.h"
#include "logging.h"
#include "context.h"
-#include "dedicated.h"
#include "sourceconsole.h"
-#include <vector>
-#include <iostream>
-#include <chrono>
+#include "spdlog/sinks/basic_file_sink.h"
+#include <iomanip>
+#include <sstream>
void InitialiseLogging()
{
@@ -13,4 +12,13 @@ void InitialiseLogging()
freopen("CONOUT$", "w", stdout);
spdlog::default_logger()->set_pattern("[%H:%M:%S] [%l] %v");
+ spdlog::flush_on(spdlog::level::info);
+
+ // generate log file, format should be nslog%d-%m-%Y %H-%M-%S.txt in gamedir/R2Northstar/logs
+ time_t time = std::time(nullptr);
+ tm currentTime = *std::localtime(&time);
+ std::stringstream stream;
+ stream << std::put_time(&currentTime, "R2Northstar/logs/nslog%d-%m-%Y %H-%M-%S.txt");
+
+ spdlog::default_logger()->sinks().push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(stream.str(), false));
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/squirrel.h b/NorthstarDedicatedTest/squirrel.h
index 3c8f9fed..bb377604 100644
--- a/NorthstarDedicatedTest/squirrel.h
+++ b/NorthstarDedicatedTest/squirrel.h
@@ -52,8 +52,7 @@ public:
public:
SquirrelManager() : sqvm(nullptr)
- {
- }
+ {}
void ExecuteCode(const char* code)
{
@@ -96,6 +95,7 @@ public:
}
}
}
+
void AddFuncRegistration(std::string returnType, std::string name, std::string argTypes, std::string helpText, SQFunction func)
{