- Print logs into stout/stderr only if verbose is set.

- `--qt-logs-only` : print only logs from the application. It strips SDK logs from the output.
- Fix peer addresses in chat rooms (group/secure)
- Add an option to display the application debug logs.
This commit is contained in:
Julien Wadel 2023-03-31 11:06:25 +02:00
parent 30d5fcd071
commit 0c74082a65
27 changed files with 324 additions and 34 deletions

View file

@ -25,6 +25,14 @@ Linphone is dual licensed, and is available either :
- [Linphone public wiki](https://wiki.linphone.org/xwiki/wiki/public/view/Linphone/)
### Parameters
`--help` : display available parameters.
`--verbose` : print logs into stdout/stderr.
`--qt-logs-only` : print only logs from the application. It strips SDK logs from the output.
## Getting started
Here are the general instructions to build Linphone for desktop. The specific instructions for each build platform is described just below.

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Zkontrolovat aktualizace</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1411,6 +1415,11 @@ Adresa URL serveru není nakonfigurována.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation>Exportovat jako</translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2617,6 +2626,11 @@ Klikněte zde: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Delete data&apos; : Action to delete all data.</extracomment>
<translation>Odstranit data</translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Tjek for opdateringer</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ Server url ikke konfigureret.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Auf Aktualisierungen prüfen</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ Server URL ist nicht konfiguriert.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Check for updates</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation>Print only logs from the application</translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ Server URL not configured.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation>Export As</translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation>Load</translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2604,6 +2613,12 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Delete data&apos; : Action to delete all data.</extracomment>
<translation>Delete data</translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translatorcomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</translatorcomment>
<translation>Full logs</translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Buscar actualizaciones</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ URL del servidor no configurada.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Vérifier les mises à jour</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ URL du serveur non configurée.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation>Exporter vers</translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation>L&apos;application va supprimer toutes ses données. Veuillez confirmer cette suppression.</translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Frissítések keresése</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1391,6 +1395,11 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2590,6 +2599,11 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Cerca aggiornamenti</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ URL del server non configurato.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation></translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1391,6 +1395,11 @@
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2590,6 +2599,11 @@
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1411,6 +1415,11 @@ Nesukonfigūruotas serverio url.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2616,6 +2625,11 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Verificar se atualizações</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ URL do servidor não configurado.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation>Exportar como</translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation>O aplicativo excluirá seus arquivos de dados do aplicativo. Você confirma ?</translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Проверить обновления</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1411,6 +1415,11 @@
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation>Экспортировать как...</translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2616,6 +2625,11 @@
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation>Файлы данных приложения будут удалены. Продолжить?</translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1401,6 +1405,11 @@ Serverwebbadressen är inte konfigurerad.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2603,6 +2612,11 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation>Güncellemeleri denetle</translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1391,6 +1395,11 @@ Sunucu url&apos;si yapılandırılmadı.</translation>
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2590,6 +2599,11 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1411,6 +1415,11 @@
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2616,6 +2625,11 @@
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -117,6 +117,10 @@
<source>checkForUpdates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>commandLineOptionQtLogsOnly</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantAbstractView</name>
@ -1391,6 +1395,11 @@
<extracomment>&quot;Export As...&quot;: Title of a file dialog to export a file.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>loadFile</source>
<extracomment>&quot;Load&quot;: Title of a file dialog to load a file.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryView</name>
@ -2590,6 +2599,11 @@
<extracomment>&apos;The application will delete your application data files. Do you confirm ?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullLogsEnabledLabel</source>
<extracomment>&apos;Full logs&apos; : label for an option to activate all logs (debug and traces)</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsAudio</name>

View file

@ -260,6 +260,8 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
if (mParser->isSet("verbose"))
Logger::getInstance()->setVerbose(true);
if (mParser->isSet("qt-logs-only"))
Logger::getInstance()->enableQtOnly(true);
// List available locales.
for (const auto &locale : QDir(Constants::LanguagePath).entryList())
@ -592,7 +594,8 @@ void App::createParser () {
#ifndef Q_OS_MACOS
{ "iconified", tr("commandLineOptionIconified") },
#endif // ifndef Q_OS_MACOS
{ { "V", "verbose" }, tr("commandLineOptionVerbose") }
{ { "V", "verbose" }, tr("commandLineOptionVerbose") },
{ "qt-logs-only", tr("commandLineOptionQtLogsOnly") },
});
}

View file

@ -63,7 +63,7 @@ static inline QByteArray getFormattedCurrentTime () {
}
// -----------------------------------------------------------------------------
// Called from SDK
class LinphoneLogger : public linphone::LoggingServiceListener {
public:
LinphoneLogger (const Logger *logger) : mLogger(logger) {}
@ -75,40 +75,43 @@ private:
linphone::LogLevel level,
const string &message
) override {
if (!mLogger->isVerbose())
bool isQtLog = domain==Constants::QtDomain;
if (!mLogger->isVerbose() || (!isQtLog && mLogger->qtOnlyEnabled()))
return;
FILE * out = stdout;
using LogLevel = linphone::LogLevel;
const char *format;
QString format = (isQtLog ? PURPLE : YELLOW ) + QString("Core:%s: " RESET "%s\n");
switch (level) {
case LogLevel::Debug:
format = GREEN "[%s][Debug]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(GREEN "[%s][Debug]");
break;
case LogLevel::Trace:
format = BLUE "[%s][Trace]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(BLUE "[%s][Trace]");
break;
case LogLevel::Message:
format = BLUE "[%s][Info]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(BLUE "[%s][Info]");
break;
case LogLevel::Warning:
format = RED "[%s][Warning]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(RED "[%s][Warning]");
out = stderr;
break;
case LogLevel::Error:
format = RED "[%s][Error]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(RED "[%s][Error]");
out = stderr;
break;
case LogLevel::Fatal:
format = RED "[%s][Fatal]" YELLOW "Core:%s: " RESET "%s\n";
format.prepend(RED "[%s][Fatal]");
out = stderr;
break;
}
fprintf(
stderr,
format,
fprintf( out,
qPrintable(format),
getFormattedCurrentTime().constData(),
domain.empty() ? domain.c_str() : EXECUTABLE_NAME,
message.c_str()
);
fflush(out);
if (level == LogLevel::Fatal)
terminate();
};
@ -117,7 +120,7 @@ private:
};
// -----------------------------------------------------------------------------
// Called from Qt
void Logger::log (QtMsgType type, const QMessageLogContext &context, const QString &msg) {
const char *format;
BctbxLogLevel level;
@ -163,8 +166,6 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
mMutex.lock();
fprintf(stdout, format, dateTime.constData(), QThread::currentThread(), contextStr, localMsg.constData());
fflush(stdout);
if( level == BCTBX_LOG_FATAL)
QMessageBox::critical(nullptr, "Linphone will crash", msg); // Print an error message before sending msg to bctoolbox
bctbx_log(Constants::QtDomain, level, "QT: %s%s", contextStr, localMsg.constData());
@ -210,7 +211,26 @@ void Logger::init (const shared_ptr<linphone::Config> &config) {
linphone::Core::setLogCollectionPath(Utils::appStringToCoreString(folder));
linphone::Core::setLogCollectionMaxFileSize(Constants::MaxLogsCollectionSize);
mInstance->enableFullLogs(SettingsModel::getFullLogsEnabled(config));
mInstance->enable(SettingsModel::getLogsEnabled(config));
}
void Logger::enableFullLogs(const bool& full){
if(mLoggingService){
mLoggingService->setLogLevel(full ? linphone::LogLevel::Debug : linphone::LogLevel::Message);
}
}
bool Logger::qtOnlyEnabled() const{
return mQtOnly;
}
void Logger::enableQtOnly(const bool& enable){
mQtOnly = enable;
if(mLoggingService){
mLoggingService->setDomain(enable ? Constants::QtDomain : "");
}
}
QString Logger::getLogText()const{

View file

@ -44,19 +44,24 @@ public:
void enable (bool status);
QString getLogText()const;
void enableFullLogs(const bool& full);
bool qtOnlyEnabled() const;
void enableQtOnly(const bool& enable);
static void init (const std::shared_ptr<linphone::Config> &config);
static Logger *getInstance () {
return mInstance;
}
private:
Logger () = default;
static void log (QtMsgType type, const QMessageLogContext &context, const QString &msg);
bool mVerbose = false;
bool mQtOnly = false;
static QMutex mMutex;
static Logger *mInstance;

View file

@ -100,11 +100,11 @@ VcardModel::VcardModel (shared_ptr<linphone::Vcard> vcard, bool isReadOnly) : QO
VcardModel::~VcardModel () {
if (!mIsReadOnly) {
qInfo() << QStringLiteral("Destroy detached vcard:") << this;
qDebug() << QStringLiteral("Destroy detached vcard:") << this;
if (!mAvatarIsReadOnly)
removeBelcardPhoto(mVcard->getVcard());
} else
qInfo() << QStringLiteral("Destroy attached vcard:") << this;
qDebug() << QStringLiteral("Destroy attached vcard:") << this;
}
// -----------------------------------------------------------------------------

View file

@ -623,15 +623,15 @@ QVariantMap SettingsModel::getVideoDefinition () const {
}
QVariantMap SettingsModel::getCurrentPreviewVideoDefinition () const {
auto definition = CoreManager::getInstance()->getCore()->getCurrentPreviewVideoDefinition();
if(definition)
return createMapFromVideoDefinition(definition);
else {
QVariantMap map;
map["width"] = 0;
map["height"] = 0;
return map;
if(CoreManager::getInstance()->getCore()->videoPreviewEnabled()){
auto definition = CoreManager::getInstance()->getCore()->getCurrentPreviewVideoDefinition();
if(definition)
return createMapFromVideoDefinition(definition);
}
QVariantMap map;
map["width"] = 0;
map["height"] = 0;
return map;
}
void SettingsModel::setVideoDefinition (const QVariantMap &definition) {
@ -1768,6 +1768,16 @@ void SettingsModel::setLogsEnabled (bool status) {
emit logsEnabledChanged(status);
}
bool SettingsModel::getFullLogsEnabled () const {
return getFullLogsEnabled(mConfig);
}
void SettingsModel::setFullLogsEnabled (bool status) {
mConfig->setInt(UiSection, "full_logs_enabled", status);
Logger::getInstance()->enableFullLogs(status);
emit fullLogsEnabledChanged();
}
// ---------------------------------------------------------------------------
QString SettingsModel::getLogsEmail () const {
@ -1849,6 +1859,9 @@ bool SettingsModel::getLogsEnabled (const shared_ptr<linphone::Config> &config)
return config ? config->getInt(UiSection, "logs_enabled", false) : true;
}
bool SettingsModel::getFullLogsEnabled (const shared_ptr<linphone::Config> &config) {
return config ? config->getInt(UiSection, "full_logs_enabled", false) : false;
}
// ---------------------------------------------------------------------------
bool SettingsModel::getVfsEncrypted (){

View file

@ -226,6 +226,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString logsFolder READ getLogsFolder WRITE setLogsFolder NOTIFY logsFolderChanged)
Q_PROPERTY(QString logsUploadUrl READ getLogsUploadUrl WRITE setLogsUploadUrl NOTIFY logsUploadUrlChanged)
Q_PROPERTY(bool logsEnabled READ getLogsEnabled WRITE setLogsEnabled NOTIFY logsEnabledChanged)
Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged)
Q_PROPERTY(QString logsEmail READ getLogsEmail WRITE setLogsEmail NOTIFY logsEmailChanged)
Q_PROPERTY(bool isVfsEncrypted READ getVfsEncrypted NOTIFY vfsEncryptedChanged)
@ -627,6 +628,9 @@ public:
bool getLogsEnabled () const;
void setLogsEnabled (bool status);
bool getFullLogsEnabled () const;
void setFullLogsEnabled (bool status);
QString getLogsEmail () const;
void setLogsEmail (const QString &email);
@ -650,6 +654,7 @@ public:
static QString getLogsFolder (const std::shared_ptr<linphone::Config> &config);
static bool getLogsEnabled (const std::shared_ptr<linphone::Config> &config);
static bool getFullLogsEnabled (const std::shared_ptr<linphone::Config> &config);
// ---------------------------------------------------------------------------
Q_INVOKABLE bool isDeveloperSettingsAvailable() const;
@ -834,6 +839,7 @@ signals:
void logsFolderChanged (const QString &folder);
void logsUploadUrlChanged (const QString &url);
void logsEnabledChanged (bool status);
void fullLogsEnabledChanged ();
void logsEmailChanged (const QString &email);
void vfsEncryptedChanged();

View file

@ -94,8 +94,8 @@ DialogPlus{
FileDialog {
id: loadAsDialog
folder: shortcuts.documents
//: "Load": Title of a file dialog to export a file.
title: 'Load'
//: "Load": Title of a file dialog to load a file.
title: qsTr('loadFile')
selectExisting: true
//defaultSuffix: Utils.getExtension(mainItem.filePath)// Doesn't seems to work on all platforms
onAccepted: {

View file

@ -45,7 +45,7 @@ ColumnLayout {
function getPeerAddress() {
if(chatRoomModel) {
if(chatRoomModel.groupEnabled || chatRoomModel.isSecure()) {
return chatRoomModel.participants.addressesToString;
return chatRoomModel.getPeerAddress();
}else {
return chatRoomModel.sipAddress;
}
@ -56,7 +56,7 @@ ColumnLayout {
function getFullPeerAddress() {
if(chatRoomModel) {
if(chatRoomModel.groupEnabled || chatRoomModel.isSecure()) {
return chatRoomModel.participants.addressesToString;
return chatRoomModel.getFullPeerAddress()
}else {
return chatRoomModel.sipAddress;
}

View file

@ -69,6 +69,16 @@ TabContainer {
onClicked: SettingsModel.logsEnabled = !checked
}
}
FormGroup {
//: 'Full logs' : label for an option to activate all logs (debug and traces)
label: qsTr('fullLogsEnabledLabel')
Switch {
checked: SettingsModel.fullLogsEnabled
onClicked: SettingsModel.fullLogsEnabled = !checked
}
}
}
}
Row {

@ -1 +1 @@
Subproject commit 2eadea70597365f32e66cceb54d949c8c4a1b94f
Subproject commit ac8896ff53184cd5716897cb35a58c0f78ecd823