[Vala] Structured logging and source files/lines/functions



Hi all,

I'm investigating using structured logging[0] for Geary, and it recommends including source file, line number and function call names in the logged data for latter debugging.

In C, these are set by G_DEBUG_HERE(), g_message, and so on, and calling those from Vala seems to include this info as advertised, I can't work out how to find this information in Vala for direct or wrapped calls to GLib.log_structured. Is it available at all? Looking a the compiler source, it doesn't seem to be getting set as a define at compile time, and I couldn't find G_STRLOC and G_STRFUNC on valadoc.org, but there aren't any tickets open in b.g.o for it, so I'm wondering if this is possible at the moment via some other means?

Also, the docs for structured logging highly recommends defining G_LOG_USE_STRUCTURED before including glib.h. Is there any way to do that in the source, or do I need to use a compiler define to be able to?

Cheers!

//Mike

[0] - <https://valadoc.org/glib-2.0/GLib.log_structured.html>

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]