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...
Veuillez vous inscrire ou vous connecter pour répondre