Supporting log levels <0 on command line too, consistent behavior or log dialog

This commit is contained in:
Matthias Koefferlein 2025-01-17 10:49:54 +01:00
parent 44038cec9e
commit 18c86cb204
4 changed files with 15 additions and 11 deletions

View File

@ -322,9 +322,6 @@ klayout_main (int &argc, char **argv)
int v = 0;
tl::from_string (argv [++i], v);
if (v < 0) {
v = 0;
}
tl::verbosity (v);
}

View File

@ -31,6 +31,16 @@
</property>
<item row="0" column="1">
<widget class="QComboBox" name="verbosity_cbx">
<item>
<property name="text">
<string>No warnings, no errors</string>
</property>
</item>
<item>
<property name="text">
<string>No warnings</string>
</property>
</item>
<item>
<property name="text">
<string>Silent</string>

View File

@ -312,9 +312,6 @@ ApplicationBase::parse_cmd (int &argc, char **argv)
int v = 0;
tl::from_string (args [++i], v);
if (v < 0) {
v = 0;
}
tl::verbosity (v);
} else if (a == "-k" && (i + 1) < argc) {
@ -1065,7 +1062,7 @@ ApplicationBase::usage ()
r += tl::to_string (QObject::tr (" -b Batch mode (same as -zz -nc -rx)")) + "\n";
r += tl::to_string (QObject::tr (" -c <config file> Use this configuration file")) + "\n";
r += tl::to_string (QObject::tr (" -nc Don't use a configuration file (implies -t)")) + "\n";
r += tl::to_string (QObject::tr (" -d <debug level> Set debug level")) + "\n";
r += tl::to_string (QObject::tr (" -d <log level> Set log level")) + "\n";
r += tl::to_string (QObject::tr (" -e Editable mode (allow editing of files)")) + "\n";
r += tl::to_string (QObject::tr (" -ne Readonly mode (editing of files is disabled)")) + "\n";
r += tl::to_string (QObject::tr (" -gr <file name> Record GUI test file")) + "\n";

View File

@ -107,9 +107,9 @@ LogReceiver::begin ()
// LogFile implementation
LogFile::LogFile (size_t max_entries, bool register_global)
: m_error_receiver (this, 0, &LogFile::add_error),
: m_error_receiver (this, -10, &LogFile::add_error),
m_warn_receiver (this, 0, &LogFile::add_warn),
m_log_receiver (this, 0, &LogFile::add_info),
m_log_receiver (this, 10, &LogFile::add_info),
m_info_receiver (this, 0, &LogFile::add_info),
m_max_entries (max_entries),
m_generation_id (0),
@ -347,7 +347,7 @@ LogViewerDialog::LogViewerDialog (QWidget *parent, bool register_global, bool in
verbosity_cbx->hide ();
verbosity_label->hide ();
} else {
verbosity_cbx->setCurrentIndex (std::min (4, tl::verbosity () / 10));
verbosity_cbx->setCurrentIndex (std::max (-2, std::min (4, tl::verbosity () / 10)) + 2);
connect (verbosity_cbx, SIGNAL (currentIndexChanged (int)), this, SLOT (verbosity_changed (int)));
}
@ -371,7 +371,7 @@ LogViewerDialog::LogViewerDialog (QWidget *parent, bool register_global, bool in
void
LogViewerDialog::verbosity_changed (int index)
{
tl::verbosity (index * 10 + 1);
tl::verbosity ((index - 2) * 10 + 1);
}
// -----------------------------------------------------------------