summaryrefslogtreecommitdiff
path: root/src/loglist.cpp
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-18 21:16:40 +0100
committerGitHub <noreply@github.com>2021-01-18 21:16:40 +0100
commitee44a38c986d953a19cbb37b0297590844cf54ac (patch)
treee39b12f7cb7f37cd96b3c3f451d2b527a81d4578 /src/loglist.cpp
parent59f055ba93381b965cdc04557ac1dce2df36bd07 (diff)
parent6feab2ea8f96704e44a14c212a635dc17f4ba71e (diff)
Merge pull request #1354 from isanae/startup-rework
Startup rework
Diffstat (limited to 'src/loglist.cpp')
-rw-r--r--src/loglist.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/loglist.cpp b/src/loglist.cpp
index 7f8f05bd..bea7363f 100644
--- a/src/loglist.cpp
+++ b/src/loglist.cpp
@@ -20,12 +20,18 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "loglist.h"
#include "organizercore.h"
#include "copyeventfilter.h"
+#include "env.h"
using namespace MOBase;
static LogModel* g_instance = nullptr;
const std::size_t MaxLines = 1000;
+static std::unique_ptr<env::Console> m_console;
+static bool m_stdout = false;
+static std::mutex m_stdoutMutex;
+
+
LogModel::LogModel()
{
}
@@ -324,6 +330,21 @@ void qtLogCallback(
}
}
+void logToStdout(bool b)
+{
+ m_stdout = b;
+
+ // logging to stdout is already set up in uibase by log::createDefault(),
+ // all it needs is to redirect stdout to the console, which is done by
+ // creating an env::Console object
+
+ if (m_stdout) {
+ m_console.reset(new env::Console);
+ } else {
+ m_console.reset();
+ }
+}
+
void initLogging()
{
LogModel::create();