Codebase list cdebconf / aa4095a
gtk: Capture new-style GLib structured logging messages under d-i GLib 2.50 replaced the non-machine-readable, text-based logging that uses g_log_set_default_handler() with a more structured logging framework inspired by systemd-journal. Each library can either use the structured or unstructured logging framework; unstructured messages are received by structured log handlers, but the opposite is not true. For the purposes of this debconf frontend, the interesting libraries include GLib and Pango (which use structured logging) and GTK 2 (which does not). As a result, GLib and Pango debug messages did not go to the syslog in d-i; now they do. Signed-off-by: Simon McVittie <smcv@debian.org> Closes: #988589 Simon McVittie 2 years ago
2 changed file(s) with 36 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
77 libnewt-dev,
88 libtextwrap-dev (>= 0.1-5),
99 libdebian-installer4-dev (>= 0.41) | libdebian-installer-dev,
10 libglib2.0-dev (>= 2.31),
10 libglib2.0-dev (>= 2.50),
1111 libgtk2.0-dev (>= 2.24) <!pkg.cdebconf.nogtk>,
1212 libcairo2-dev (>= 1.8.10-3) <!pkg.cdebconf.nogtk>,
1313 libselinux1-dev (>= 2.3) [linux-any] | libselinux-dev [linux-any],
141141 g_free(string);
142142 }
143143
144 /** Implementation of GLogFunc for the GTK+ frontend.
145 *
146 * This will log messages going through the glib log system to the standard
147 * syslog.
148 *
149 * @param log_domain the log domain of the message
150 * @param log_level the log level of the message
151 * @param message the message to process
152 * @param user_data user data, set in g_log_set_handler()
153 */
154 static GLogWriterOutput log_glib_structured_to_syslog(GLogLevelFlags log_level,
155 const GLogField *fields,
156 gsize n_fields,
157 gpointer user_data)
158 {
159 const char *domain = NULL;
160 const char *message = "(no message)";
161 gsize i;
162
163 for (i = 0; i < n_fields; i++) {
164 const GLogField *field = &fields[i];
165
166 if (g_strcmp0(field->key, "MESSAGE") == 0) {
167 message = field->value;
168 }
169 else if (g_strcmp0(field->key, "GLIB_DOMAIN") == 0) {
170 domain = field->value;
171 }
172 }
173
174 log_glib_to_syslog(domain, log_level, message, NULL);
175 return G_LOG_WRITER_HANDLED;
176 }
177
144178 /** Make the given window fullscreen.
145179 *
146180 * @param window main window
286320 fe_data->di_data = di_data;
287321
288322 (void) g_set_printerr_handler(print_to_syslog);
289 (void) g_log_set_default_handler(log_glib_to_syslog, NULL);
323 g_log_set_writer_func(log_glib_structured_to_syslog, NULL, NULL);
290324
291325 make_fullscreen(fe_data->window);
292326 set_shortcuts(fe);