Hi; On Friday, 12 August 2016, Philip Withnall <phi...@tecnocode.co.uk> wrote:
> Hi all, > > During the talk on GLib's new structured logging API at GUADEC today, > it was pointed out that g_log_structured() (and the rest of the > interesting bits of the new structured logging API) are not > introspectable. > > I'm not sure what we can do about this. The API is based around > GLogField, which is basically a pointer and a length, and hence is not > introspectable: > > struct _GLogField > { > const gchar *key; > gconstpointer value; > gssize length; > }; > > My suggestion would be for bindings to manually bind > g_log_structured_array() with whatever language-specific syntax or API > they see fit, and to ignore the GIR definitions of g_log_structured() > and g_log_structured_array(). > > Thoughts? > Sadly, you can't just "manually bind" things, as that would need a C wrapper around the C API. Luckily we have pretty simple fixes for a string-based approach: just add a GLogField boxed GType that copies and frees the structure, and strings will automatically work. For pointers one way to fix this would be to associate a free_func to the data so that language bindings could release references when deallocating the log field data structure. From a C API reference point that would need adding a GDestroyNotify argument to g_log_structured_array() that would always be NULL except for use with language bindings. Bindings would also need an ad hoc writer function if they wanted access to opaque data pointer keys, but that would be easy to add. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com]
_______________________________________________ desktop-devel-list mailing list desktop-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/desktop-devel-list