6#include "gtest/gtest.h"
13bool gtk_initialized =
false;
14GLogWriterFunc log_writer_cb =
nullptr;
15GLogLevelFlags fl_received_log_levels = (GLogLevelFlags)0x0;
17GLogWriterOutput log_writer(GLogLevelFlags log_level,
18 const GLogField* fields,
21 fl_received_log_levels = (GLogLevelFlags)(log_level | fl_received_log_levels);
22 if (log_writer_cb ==
nullptr) {
23 return g_log_writer_default(log_level, fields, n_fields,
user_data);
26 log_writer_cb(log_level, fields, n_fields,
user_data);
27 if (
result != G_LOG_WRITER_HANDLED) {
28 return g_log_writer_default(log_level, fields, n_fields,
user_data);
36 if (!gtk_initialized) {
38 g_log_set_writer_func(log_writer,
nullptr,
nullptr);
39 gtk_initialized =
true;
42 log_writer_cb = writer;
46 fl_received_log_levels = (GLogLevelFlags)0x0;
50 return fl_received_log_levels;
GLogLevelFlags fl_get_received_gtk_log_levels()
Returns the recorded log levels.
void fl_ensure_gtk_init(GLogWriterFunc writer)
Ensures that GTK has been initialized and starts monitoring logs.
void fl_reset_received_gtk_log_levels()
Resets the recorded log levels.