diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 00:35:33 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 00:35:33 (GMT) |
commit | a6975c1d754a1ba5bfb9e23f0b26692c746e6f9c (patch) | |
tree | 7ec962129ebbce6cd210b449443afc91ced72719 /src/main.c | |
parent | 5adcf950f1f928c7127f2d694b52addf54cc04ca (diff) |
Handled the logs from the GUI, the command line and the Python bindings.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -36,6 +36,7 @@ #include "common/xdg.h" #include "core/core.h" #include "core/global.h" +#include "core/logs.h" #include "core/params.h" #include "glibext/delayed.h" #include "gui/editor.h" @@ -89,7 +90,8 @@ static void show_chrysalide_help(const char *name) printf("\n"); - printf("\t--batch\t\tExit after processing files.\n"); + printf("\t--verbosity=level\tSet the log level (0 for all messages, %u for none).\n", LMT_COUNT); + printf("\t--batch\t\t\tExit after processing files.\n"); printf("\n"); @@ -145,6 +147,7 @@ int main(int argc, char **argv) int result; /* Bilan de l'exécution */ bool show_help; /* Affichage de l'aide ? */ bool show_version; /* Affichage de la version ? */ + LogMessageType verbosity; /* Niveau de filtre de message */ bool batch_mode; /* Exécution sans GUI ? */ int index; /* Indice d'argument */ int ret; /* Bilan d'un appel */ @@ -160,10 +163,11 @@ int main(int argc, char **argv) bool welcome; /* Affichage de la bienvenue ? */ static struct option long_options[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, - { "batch", no_argument, NULL, 'b' }, - { NULL, 0, NULL, 0 } + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'v' }, + { "verbosity", required_argument, NULL, 'V' }, + { "batch", no_argument, NULL, 'b' }, + { NULL, 0, NULL, 0 } }; result = EXIT_FAILURE; @@ -180,11 +184,12 @@ int main(int argc, char **argv) show_help = false; show_version = false; + verbosity = LMT_INFO; batch_mode = false; while (true) { - ret = getopt_long(argc, argv, "hvb", long_options, &index); + ret = getopt_long(argc, argv, "hvV:b", long_options, &index); if (ret == -1) break; switch (ret) @@ -197,6 +202,10 @@ int main(int argc, char **argv) show_version = true; break; + case 'V': + verbosity = strtoul(optarg, NULL, 10); + break; + case 'b': batch_mode = true; break; @@ -235,6 +244,9 @@ int main(int argc, char **argv) gtk_init(&argc, &argv); /* Initialisation du programme */ + + set_log_verbosity(verbosity); + if (!load_all_basic_components()) return EXIT_FAILURE; |