106 const QMessageLogContext& context,
136 if (msgLevel < MNE_LOG_LEVEL)
140 std::string text = msg.toStdString();
142 std::lock_guard<std::mutex> lock(m_mutex);
149 if (!m_sLogFilePath.isEmpty()) {
151 if (
logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
152 const char* fileLevel =
"";
175 stream << QDateTime::currentDateTime().toString(
"yyyy-MM-dd hh:mm:ss.zzz")
176 <<
" [" << fileLevel <<
"] "
177 << QString::fromStdString(text).trimmed() <<
'\n';
182#ifdef MNE_LOG_MODE_FORMATTED
183 static bool s_startOfLine =
true;
187 const char* level =
"";
216 std::string sDateTime;
218 std::string prefix = std::string(color) + sDateTime + level +
COLOR_RESET;
222 for (
size_t i = 0; i < text.size(); ++i) {
223 if (s_startOfLine && text[i] !=
'\n') {
225 s_startOfLine =
false;
227 std::cout << text[i];
228 if (text[i] ==
'\n') {
229 s_startOfLine =
true;
233 if (text.empty() || text.back() !=
'\n') {
235 s_startOfLine =
true;
240 if (text.empty() || text.back() !=
'\n') {