diff --git a/src/logger.cpp b/src/logger.cpp index b077a6ce..eac12329 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -2,9 +2,8 @@ #include #include -#include #include -#include // for dup2 +// #include // for dup2 namespace rack { @@ -17,9 +16,10 @@ static std::mutex logMutex; void init() { + std::lock_guard lock(logMutex); startTime = system::getTime(); // Don't open a file in development mode. - if (settings::devMode) { + if (asset::logPath.empty()) { outputFile = stderr; return; } @@ -37,6 +37,7 @@ void init() { } void destroy() { + std::lock_guard lock(logMutex); if (outputFile && outputFile != stderr) { // Print end token so we know if the logger exited cleanly. std::fprintf(outputFile, "END"); @@ -96,7 +97,7 @@ static bool fileEndsWith(FILE* file, std::string str) { } bool isTruncated() { - if (settings::devMode) + if (asset::logPath.empty()) return false; // Open existing log file diff --git a/standalone/main.cpp b/standalone/main.cpp index b7c27be9..b786225f 100644 --- a/standalone/main.cpp +++ b/standalone/main.cpp @@ -223,12 +223,13 @@ int main(int argc, char* argv[]) { INFO("Running window"); APP->window->run(); INFO("Stopped window"); - delete APP->window; - APP->window = NULL; - INFO("Re-creating window"); - APP->window = new Window; - APP->window->run(); + // INFO("Destroying window"); + // delete APP->window; + // APP->window = NULL; + // INFO("Re-creating window"); + // APP->window = new Window; + // APP->window->run(); } // Destroy context