Skip to content

Commit

Permalink
Supporting log levels <0 on command line too, consistent behavior or …
Browse files Browse the repository at this point in the history
…log dialog
  • Loading branch information
Matthias Koefferlein committed Jan 17, 2025
1 parent 44038ce commit 18c86cb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/klayout_main/klayout_main/klayout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Expand Down
10 changes: 10 additions & 0 deletions src/lay/lay/LogViewerDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 1 addition & 4 deletions src/lay/lay/layApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions src/lay/lay/layLogViewerDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)));
}

Expand All @@ -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);
}

// -----------------------------------------------------------------
Expand Down

0 comments on commit 18c86cb

Please sign in to comment.