aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/logging.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-21 16:40:01 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-21 16:40:01 +0100
commit8564c36b49f5f0451be5036371e421a44425b02e (patch)
treefcd1fbe100e7c8fb9ba7eee8e5923abd5ad0ba27 /NorthstarDedicatedTest/logging.cpp
parent8650a7520baec35765bc837d9313325e0c7631d3 (diff)
downloadNorthstarLauncher-8564c36b49f5f0451be5036371e421a44425b02e.tar.gz
NorthstarLauncher-8564c36b49f5f0451be5036371e421a44425b02e.zip
add some basic filesystem stuff and client/ui script callbacks
Diffstat (limited to 'NorthstarDedicatedTest/logging.cpp')
-rw-r--r--NorthstarDedicatedTest/logging.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 66f2de4c..721c00f5 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -1,6 +1,5 @@
#include "pch.h"
#include "logging.h"
-#include "context.h"
#include "sourceconsole.h"
#include "spdlog/sinks/basic_file_sink.h"
#include <iomanip>
@@ -14,11 +13,14 @@ void InitialiseLogging()
spdlog::default_logger()->set_pattern("[%H:%M:%S] [%l] %v");
spdlog::flush_on(spdlog::level::info);
+ // log file stuff
// generate log file, format should be nslog%d-%m-%Y %H-%M-%S.txt in gamedir/R2Northstar/logs
+ // todo: might be good to delete logs that are too old
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");
+ // create logger
spdlog::default_logger()->sinks().push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(stream.str(), false));
} \ No newline at end of file