Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging rework #807

Merged
merged 27 commits into from
Aug 2, 2019
Merged

Logging rework #807

merged 27 commits into from
Aug 2, 2019

Conversation

isanae
Copy link
Contributor

@isanae isanae commented Aug 2, 2019

This is not as bad as it looks.

A lot of the modifications are actually moving all the logging stuff I did a while ago for modules, AVs, etc. from util.cpp/h to a bunch of new env*.cpp/h files. You can collapse these files.

  • I changed all qDebug(), qInfo(), qWarning() and qCritical() to the new logging functions. This is the bulk of the changes.

  • I renamed logbuffer.cpp/h to loglist.cpp/h, because it also handles the widget. I moved the widget to a docked window, changed the timestamp to include seconds and milliseconds, and added options to the context menu to clear the log and change the log level.

  • Qt is buggy when saving and restoring dock positions. I added a class DockFixer in mainwindow.cpp to fix the problems, all the gory details are in it.

  • I added some logging on startup:

    • All configured executables;
    • Basic checks for missing files that are typically eaten by AVs in checkMissingFiles();
    • A specific check for Nahimic drivers that are known to cause issues in checkNahimic();
    • A list of all displays, graphics adapters and DPI settings.
  • I removed a few logs that were noisy and unhelpful, such as the "network interface seems up". I also deleted a few commented out code blocks.

  • OrganizerCore used to have the Settings object as a member variable, initialized by a QSettings passed in the constructor in runApplication(). Since logging has to be initialized as soon as possible, and I need the log level from the settings, I moved the Settings object to runApplication() itself. OrganizerCore only has a reference to it now. It doesn't change much, just that Settings is created earlier.

  • It used to be that logbuffer.cpp would register a callback to Qt's log to add entries to the list. This is now reversed: main.cpp registers the callback in qtLogCallback(), which forwards to the new log functions. The log list now has a callback to the new log instead.

  • I removed getCurrentErrorStringA() and getCurrentErrorStringW() from errorreport.cpp/h because they were redundant and used only in a few places. Now everything uses formatSystemMessage().

isanae added 27 commits July 22, 2019 07:32
added a menu item in the view menu for it
renamed log() to vlog() for now
extracted console creation to Console class
rewrote LogBuffer to work with logging from uibase, renamed to LogModel
added fmt dependency
create log level combobox in code, set selected index based on value instead
added log level to context menu in log list
… access settings early

set log level on startup
replaced more qDebug()
replaced qWarnings() and qCritical()
log displays on startup
removed now unused vlog()
removed some commented out logging
replaced windowsErrorString() with formatSystemMessage()
initializing usvfs logging now logs strings for log level and crash dump type
moved context menu to LogList
@Silarn Silarn merged commit cff5264 into ModOrganizer2:Develop Aug 2, 2019
@isanae isanae deleted the logging-rework branch December 10, 2019 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants