mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Redirect logs to the application log file again
In commit 4de109bbf1
, qDebug() was
replaced with report_info(). As a side effect, the subsurface log
messages are no longer redirected to the application log file. Only the
internal Qt logging ends up in the log file.
For bug reporting by end-users, this application log file is important
because it's the easiest way to collect all the necessary information to
investigate the problem.
Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
This commit is contained in:
parent
be6b017534
commit
7d1e0ef0d1
2 changed files with 12 additions and 7 deletions
|
@ -11,6 +11,10 @@
|
|||
#define LOG_MSG(fmt, s) __android_log_print(ANDROID_LOG_INFO, "Subsurface", fmt, s);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
extern void writeToAppLogFile(QString logText);
|
||||
#endif
|
||||
|
||||
int verbose;
|
||||
|
||||
void report_info(const char *fmt, ...)
|
||||
|
@ -20,6 +24,10 @@ void report_info(const char *fmt, ...)
|
|||
std::string s = vformat_string_std(fmt, args);
|
||||
va_end(args);
|
||||
LOG_MSG("INFO: %s\n", s.c_str());
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
writeToAppLogFile(s.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
static void (*error_cb)(std::string) = NULL;
|
||||
|
@ -32,6 +40,10 @@ int report_error(const char *fmt, ...)
|
|||
va_end(args);
|
||||
LOG_MSG("ERROR: %s\n", s.c_str());
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
writeToAppLogFile(s.c_str());
|
||||
#endif
|
||||
|
||||
/* if there is no error callback registered, don't produce errors */
|
||||
if (error_cb)
|
||||
error_cb(std::move(s));
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
#include "core/errorhelper.h"
|
||||
#include "QRegularExpression"
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
extern void writeToAppLogFile(QString logText);
|
||||
#endif
|
||||
|
||||
void logMessageHandler(QtMsgType type, const QMessageLogContext&, const QString &msg)
|
||||
{
|
||||
MessageHandlerModel::self()->addLog(type, msg);
|
||||
|
@ -48,9 +44,6 @@ void MessageHandlerModel::addLog(QtMsgType type, const QString& message)
|
|||
m_data.append({message, type});
|
||||
endInsertRows();
|
||||
report_info("%s", qPrintable(message));
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
writeToAppLogFile(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
const QString MessageHandlerModel::logAsString()
|
||||
|
|
Loading…
Add table
Reference in a new issue