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';
183 const bool bDiagnostic = msgLevel >= 2;
184 std::ostream& stream = bDiagnostic ? std::cerr : std::cout;
186#ifdef MNE_LOG_MODE_FORMATTED
187 static bool s_startOfLine[2] = {
true,
true};
188 bool& startOfLine = s_startOfLine[bDiagnostic ? 1 : 0];
192 const char* level =
"";
221 std::string sDateTime;
223 std::string prefix = std::string(color) + sDateTime + level +
COLOR_RESET;
227 for (
size_t i = 0; i < text.size(); ++i) {
228 if (startOfLine && text[i] !=
'\n') {
233 if (text[i] ==
'\n') {
238 if (text.empty() || text.back() !=
'\n') {
245 if (text.empty() || text.back() !=
'\n') {