diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-05-14 20:00:12 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-05-14 20:00:12 (GMT) |
commit | ed57185faa4d7a53d953cf74a6f8626f44ce9b75 (patch) | |
tree | f34cb583e8c0d054676adb9f1da826aa92479d11 /src/core | |
parent | e9f10d8fe1c5e9f8a70801c1cd4d3d342e290f15 (diff) |
Restore some logging facilities with automatic switch to the GUI.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 8 | ||||
-rw-r--r-- | src/core/logs.c | 32 |
2 files changed, 14 insertions, 26 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index ac1ae14..f329a09 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -1,5 +1,5 @@ -noinst_LTLIBRARIES = libcore.la +noinst_LTLIBRARIES = libcore4.la # libcore.la libcore_la_SOURCES = \ collections.h collections.c \ @@ -17,6 +17,12 @@ libcore_la_SOURCES = \ libcore_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) +libcore4_la_SOURCES = \ + logs.h logs.c + +libcore4_la_CFLAGS = $(TOOLKIT_CFLAGS) + + devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libcore_la_SOURCES:%c=) diff --git a/src/core/logs.c b/src/core/logs.c index 2b2b1ab..453eaff 100644 --- a/src/core/logs.c +++ b/src/core/logs.c @@ -29,10 +29,6 @@ #include "../common/extstr.h" -#ifdef INCLUDE_GTK_SUPPORT -# include "../gui/core/items.h" -# include "../gui/panels/log.h" -#endif @@ -45,9 +41,11 @@ /* Conserve le niveau de filtre des messages */ static LogMessageType _verbosity = LMT_COUNT; +/* Affiche un message dans le terminal courant. */ +__attribute__((weak)) void do_log_message_alt(LogMessageType, const char *); /* Affiche un message dans le terminal courant. */ -static void print_message_without_gui(LogMessageType, const char *); +static void do_log_message_nox(LogMessageType, const char *); @@ -109,28 +107,12 @@ void set_log_verbosity(LogMessageType level) void log_simple_message(LogMessageType type, const char *msg) { -#ifdef INCLUDE_GTK_SUPPORT - GEditorItem *item; /* Eventuel affichage présent */ -#endif - if (type >= _verbosity) { -#ifdef INCLUDE_GTK_SUPPORT - - item = find_editor_item_by_type(G_TYPE_LOG_PANEL); - - if (item != NULL) - { - g_log_panel_add_message(G_LOG_PANEL(item), type, msg); - g_object_unref(G_OBJECT(item)); - } - + if (do_log_message_alt != NULL) + do_log_message_alt(type, msg); else - -#endif - - print_message_without_gui(type, msg); - + do_log_message_nox(type, msg); } } @@ -236,7 +218,7 @@ void log_variadic_message(LogMessageType type, const char *fmt, ...) * * ******************************************************************************/ -static void print_message_without_gui(LogMessageType type, const char *msg) +static void do_log_message_nox(LogMessageType type, const char *msg) { char *formatted; /* Copie formatée du message */ const char *prefix; /* Introduction de la ligne */ |