Skip to content
Extraits de code Groupes Projets

Add clean logs support + dependent MR

Fusionnées Kubat a demandé de fusionner log-macros vers master

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 like auto 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 the MainWindow, like the console with VSCode or Eclipse
  • Create the LogDispatcherThread -> flush at regular intervals the LogSink

Also merge dependent MR with this one to uniformize the logging process

Modification effectuée par Kubat

Rapports de requête de fusion

Loading
Loading

Activité

Filtrer l'activité
  • Approbations
  • Assignés et relecteurs
  • Commentaires (des bots)
  • Commentaires (des utilisateurs)
  • Branches et validations
  • Modifications
  • Labels
  • État de verrouillage
  • Mentions
  • État de la demande de fusion
  • Suivi
Veuillez vous inscrire ou vous connecter pour répondre
Chargement en cours