Re: g_log_structured() and introspection
- From: Emmanuele Bassi <ebassi gmail com>
- To: Philip Withnall <philip tecnocode co uk>
- Cc: "desktop-devel-list gnome org" <desktop-devel-list gnome org>
- Subject: Re: g_log_structured() and introspection
- Date: Sat, 13 Aug 2016 08:01:35 +0100
Hi;
On Friday, 12 August 2016, Philip Withnall <
philip 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]
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]