Add clean logs support + dependent MR
Description
Add some mechanisms to add log support to Vivy.
- A
LogSink
is an object that will collect all the logs and emit them to a file,stderr
, or in a Qt widget - A
Logger
is the object used to create log message and submit them to the sink - A
LogMessage
is a message, a line of log. You should not create it yourself, but use the macros or defined methods. They are submitted on destruction, so don't try things likeauto msg = VIVY_LOG_WARN(appLog); msg << "toto";
unless you know what you are doing. If you don't pay attention, you might get log messages in a different order than what you originally wanted.
Example
Here is a small demo:
// Custom sink
VIVY_DCL_LOG_SINK(logSink) // Declare a Sink
std::shared_ptr<Logger> scriptLog = VIVY_GET_LOGGER(mySink, SCRIPT); // Custom logger
VIVY_LOG_WARN(scriptLog) << "This is" << ' ' << "very usefull!"; // Use the custom logger
// With the vivyApp's sink
class Object {
// Add a logger to the sink and add log methods to the object
VIVY_APP_LOGGABLE_OBJECT(Object, logger)
public:
// ...
};
TODO List
-
Create and use the API -
The simple stderr dispatcher -
The VivyConsoleDispatcher
-> a dock widget with theMainWindow
, like the console with VSCode or Eclipse -
Create the LogDispatcherThread
-> flush at regular intervals theLogSink
Also merge dependent MR with this one to uniformize the logging process
Modification effectuée par Kubat
Rapports de requête de fusion
Activité
assigned to @martin2018
added 14 commits
- 59bacba8 - LOG: Add things to log in the VivyApplication class to test the thing
- bd43295f - LOG: Send the messages to the queue in a thread safe way, clear the loggers...
- 21457a79 - LOG: Get a logger from the sink if it was already created
- 3592c012 - LOG: Add the base LogSinkDispatcher class and the flush mechanism for the LogSink
- 8c34952f - MISC: Separate implementation of the different classes of Log.hh into multiple...
- 6a630f8e - LOG: Add the StderrLogSinkDispatcher to log things to stderr
- f6996503 - LOG: Fix the message sinking process...
- fd87ea33 - LOG: Fix the log dispatch creation
- f489281e - LOG: Add the flushLogSink utility method to help with the use of the log system
- 0a4a83ca - LOG: The newDispatch creation for a sink now supports constructors with arguments
- de9dd501 - LOG: Add a way to get the sink from the VivyApplication and add more...
- e901daa4 - BUILD: Fix header include order
- 66c5f4d5 - LOG: Add some logs, pb on flush on exit because the messages outlive the...
- a67b15d3 - BUILD: Should fix the problems with the include order of things
Afficher/masquer la liste des validationsadded 1 commit
- 8059746b - LOG: Use the new LOG API in the UI part of Vivy
added 1 commit
- f4a50481 - LOG: First level of std/Lib uses the new LOG API
added 1 commit
- 7db35b62 - LOG: The src/Ass subdir is using the new LOG API
added 1 commit
- 1506c2d1 - LOG: The src/Lib/Document now uses the new LOG API
added 1 commit
- 74a09b6a - FIX: Fix segfault -> create the stores on application startup
added 1 commit
- 478cc5cf - LOG: The src/Lib/Script subfolder uses the new LOG API [+REGRESSION]
added 1 commit
- 064c56e0 - MISC: Get ride of VivyCli and everything is placed in VivyApplication (because...
added 1 commit
- 53c37247 - LOG: Get ride of the ../ in file with the logs
added 7 commits
- b94c1f05 - LOG: Add a clean way to create loggers
- 96d4b496 - FIX: Fix segfault -> create the stores on application startup
- e4367dc6 - LOG: The src/Lib/Script subfolder uses the new LOG API [+REGRESSION]
- a5fa9a83 - MISC: Get ride of VivyCli and everything is placed in VivyApplication (because...
- fb985066 - LOG: Get ride of the ../ in file with the logs
- d84975b2 - LOG: Abort on logFatal()
- 56366479 - BUILD: Fix gcc warnings
Afficher/masquer la liste des validationsadded 7 commits
- 6b8cc899 - LOG: Add a clean way to create loggers
- 40ad0795 - FIX: Fix segfault -> create the stores on application startup
- 6f2598e3 - LOG: The src/Lib/Script subfolder uses the new LOG API [+REGRESSION]
- fcc86722 - MISC: Get ride of VivyCli and everything is placed in VivyApplication (because...
- 22ebeab1 - LOG: Get ride of the ../ in file with the logs
- 64e20911 - LOG: Abort on logFatal()
- 27e17ac7 - BUILD: Fix gcc warnings
Afficher/masquer la liste des validationsadded 1 commit
- 9803344f - LOG: Add a worker thread for logs, it will launch the `flush` operation in a...
added 1 commit
- 19c48a8c - UI: Add a first dirty log console widget docked to the main window
added 1 commit
- a653603f - UI: Avoid the segfault on MainWindow destruction
added 1 commit
- 8d42c780 - UI: Always scroll to last item in the LogConsole
added enhancement lib to-review labels
requested review from @Lec
mentioned in merge request !24 (merged)
added 5 commits
- c54d8d6e - SCRIPT: Manual way of creating the FreeFunctions object to get the current vivy document
- ef96ce87 - SCRIPT: Add a way to attach a VivyDocument to a LuaContext
- e3c71210 - SCRIPT: Add getters to get some VivyDocument properties from the script API
- 626005b8 - SCRIPT: Update the lua lib with the new free functions
- e34c0a23 - Merge branch 'script-document-access-functions' into 'log-macros'
Afficher/masquer la liste des validationsadded 8 commits
- c5f31ac4 - MISC: Add QtCreator's theme files
- 0fe85263 - UI: Import and modify QtCreator's theming system (simplify it a bit)
- 96fb877e - UI: Use the new theming system to set Vivy's theme
- 4027fe7e - UI: The theme now supports the "VivyTheme" and "SystemTheme" modes
- 429ab12a - UI: The highlighter theme is now contained inside the global Theme structure
- 4ebfd0c6 - MISC: Try to hide things in the .cc file for the Theme class
- b225120e - MISC: Make things constexpr when possible
- d85eff0d - Merge branch 'theme' into 'log-macros'
Afficher/masquer la liste des validationsadded 1 commit
- 8313c037 - Move the enums from the Theme class to the Utils.hh header to prepare the Theme class log-ability
added 1 commit
- 3c6a8ccd - LOG: Use the new LOG API in more place and remove old qDebug
removed to-review label
mentioned in commit 34632648
Veuillez vous inscrire ou vous connecter pour répondre