1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11)
12
13// Specifies the prototype of log handler functions.
14//
15// The default log handler, [func@GLib.log_default_handler], automatically appends a
16// new-line character to @message when printing it. It is advised that any
17// custom log handler functions behave similarly, so that logging calls in user
18// code do not need modifying to add a new-line character to the message if the
19// log handler is changed.
20//
21// The `log_domain` parameter can be set to `NULL` or an empty string to use the default
22// application domain.
23//
24// This is not used if structured logging is enabled; see
25// [Using Structured Logging](logging.html#using-structured-logging).
26type LogFunc func(string, LogLevelFlags, string, uintptr)
27
28// Writer function for log entries. A log entry is a collection of one or more
29// #GLogFields, using the standard [field names from journal
30// specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
31// See g_log_structured() for more information.
32//
33// Writer functions must ignore fields which they do not recognise, unless they
34// can write arbitrary binary output, as field values may be arbitrary binary.
35//
36// @log_level is guaranteed to be included in @fields as the `PRIORITY` field,
37// but is provided separately for convenience of deciding whether or where to
38// output the log entry.
39//
40// Writer functions should return %G_LOG_WRITER_HANDLED if they handled the log
41// message successfully or if they deliberately ignored it. If there was an
42// error handling the message (for example, if the writer function is meant to
43// send messages to a remote logging server and there is a network error), it
44// should return %G_LOG_WRITER_UNHANDLED. This allows writer functions to be
45// chained and fall back to simpler handlers in case of failure.
46type LogWriterFunc func(LogLevelFlags, []LogField, uint, uintptr) LogWriterOutput
47
48// Specifies the type of the print handler functions.
49// These are called with the complete formatted string to output.
50type PrintFunc func(string)
51
52// Structure representing a single field in a structured log entry. See
53// g_log_structured() for details.
54//
55// Log fields may contain arbitrary values, including binary with embedded nul
56// bytes. If the field contains a string, the string must be UTF-8 encoded and
57// have a trailing nul byte. Otherwise, @length must be set to a non-negative
58// value.
59type LogField struct {
60 _ structs.HostLayout
61
62 Key uintptr
63
64 Value uintptr
65
66 Length int
67}
68
69func (x *LogField) GoPointer() uintptr {
70 return uintptr(unsafe.Pointer(x))
71}
72
73const (
74 // Defines the log domain. See [Log Domains](#log-domains).
75 //
76 // Libraries should define this so that any messages
77 // which they log can be differentiated from messages from other
78 // libraries and application code. But be careful not to define
79 // it in any public header files.
80 //
81 // Log domains must be unique, and it is recommended that they are the
82 // application or library name, optionally followed by a hyphen and a sub-domain
83 // name. For example, `bloatpad` or `bloatpad-io`.
84 //
85 // If undefined, it defaults to the default %NULL (or `""`) log domain; this is
86 // not advisable, as it cannot be filtered against using the `G_MESSAGES_DEBUG`
87 // environment variable.
88 //
89 // For example, GTK uses this in its `Makefile.am`:
90 // |[
91 // AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gtk\"
92 // ]|
93 //
94 // Applications can choose to leave it as the default %NULL (or `""`)
95 // domain. However, defining the domain offers the same advantages as
96 // above.
97 LOG_DOMAIN byte = 0
98 // GLib log levels that are considered fatal by default.
99 //
100 // This is not used if structured logging is enabled; see
101 // [Using Structured Logging](logging.html#using-structured-logging).
102 LOG_FATAL_MASK int = 5
103 // Log levels below `1<<G_LOG_LEVEL_USER_SHIFT` are used by GLib.
104 // Higher bits can be used for user-defined log levels.
105 LOG_LEVEL_USER_SHIFT int = 8
106)
107
108// Flags specifying the level of log messages.
109//
110// It is possible to change how GLib treats messages of the various
111// levels using [func@GLib.log_set_handler] and [func@GLib.log_set_fatal_mask].
112type LogLevelFlags int
113
114const (
115
116 // internal flag
117 GLogFlagRecursionValue LogLevelFlags = 1
118 // internal flag
119 GLogFlagFatalValue LogLevelFlags = 2
120 // log level for errors, see [func@GLib.error].
121 // This level is also used for messages produced by [func@GLib.assert].
122 GLogLevelErrorValue LogLevelFlags = 4
123 // log level for critical warning messages, see
124 // [func@GLib.critical]. This level is also used for messages produced by
125 // [func@GLib.return_if_fail] and [func@GLib.return_val_if_fail].
126 GLogLevelCriticalValue LogLevelFlags = 8
127 // log level for warnings, see [func@GLib.warning]
128 GLogLevelWarningValue LogLevelFlags = 16
129 // log level for messages, see [func@GLib.message]
130 GLogLevelMessageValue LogLevelFlags = 32
131 // log level for informational messages, see [func@GLib.info]
132 GLogLevelInfoValue LogLevelFlags = 64
133 // log level for debug messages, see [func@GLib.debug]
134 GLogLevelDebugValue LogLevelFlags = 128
135 // a mask including all log levels
136 GLogLevelMaskValue LogLevelFlags = -4
137)
138
139// Return values from #GLogWriterFuncs to indicate whether the given log entry
140// was successfully handled by the writer, or whether there was an error in
141// handling it (and hence a fallback writer should be used).
142//
143// If a #GLogWriterFunc ignores a log entry, it should return
144// %G_LOG_WRITER_HANDLED.
145type LogWriterOutput int
146
147const (
148
149 // Log writer has handled the log entry.
150 GLogWriterHandledValue LogWriterOutput = 1
151 // Log writer could not handle the log entry.
152 GLogWriterUnhandledValue LogWriterOutput = 0
153)
154
155var xAssertWarning func(string, string, int, string, string)
156
157func AssertWarning(LogDomainVar string, FileVar string, LineVar int, PrettyFunctionVar string, ExpressionVar string) {
158
159 xAssertWarning(LogDomainVar, FileVar, LineVar, PrettyFunctionVar, ExpressionVar)
160
161}
162
163var xLog func(uintptr, LogLevelFlags, string, ...interface{})
164
165// Logs an error or debugging message.
166//
167// If the log level has been set as fatal, [func@GLib.BREAKPOINT] is called
168// to terminate the program. See the documentation for [func@GLib.BREAKPOINT] for
169// details of the debugging options this provides.
170//
171// If [func@GLib.log_default_handler] is used as the log handler function, a new-line
172// character will automatically be appended to @..., and need not be entered
173// manually.
174//
175// If [structured logging is enabled](logging.html#using-structured-logging) this will
176// output via the structured log writer function (see [func@GLib.log_set_writer_func]).
177func Log(LogDomainVar *string, LogLevelVar LogLevelFlags, FormatVar string, varArgs ...interface{}) {
178
179 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
180 defer core.GFreeNullable(LogDomainVarPtr)
181
182 xLog(LogDomainVarPtr, LogLevelVar, FormatVar, varArgs...)
183
184}
185
186var xLogDefaultHandler func(uintptr, LogLevelFlags, uintptr, uintptr)
187
188// The default log handler set up by GLib; [func@GLib.log_set_default_handler]
189// allows to install an alternate default log handler.
190//
191// This is used if no log handler has been set for the particular log
192// domain and log level combination. It outputs the message to `stderr`
193// or `stdout` and if the log level is fatal it calls [func@GLib.BREAKPOINT]. It automatically
194// prints a new-line character after the message, so one does not need to be
195// manually included in @message.
196//
197// The behavior of this log handler can be influenced by a number of
198// environment variables:
199//
200// - `G_MESSAGES_PREFIXED`: A `:`-separated list of log levels for which
201// messages should be prefixed by the program name and PID of the
202// application.
203// - `G_MESSAGES_DEBUG`: A space-separated list of log domains for
204// which debug and informational messages are printed. By default
205// these messages are not printed. If you need to set the allowed
206// domains at runtime, use [func@GLib.log_writer_default_set_debug_domains].
207// - `DEBUG_INVOCATION`: If set to `1`, this is equivalent to
208// `G_MESSAGES_DEBUG=all`. `DEBUG_INVOCATION` is a standard environment
209// variable set by systemd to prompt debug output. (Since: 2.84)
210//
211// `stderr` is used for levels [flags@GLib.LogLevelFlags.LEVEL_ERROR],
212// [flags@GLib.LogLevelFlags.LEVEL_CRITICAL], [flags@GLib.LogLevelFlags.LEVEL_WARNING] and
213// [flags@GLib.LogLevelFlags.LEVEL_MESSAGE]. `stdout` is used for
214// the rest, unless `stderr` was requested by
215// [func@GLib.log_writer_default_set_use_stderr].
216//
217// This has no effect if structured logging is enabled; see
218// [Using Structured Logging](logging.html#using-structured-logging).
219func LogDefaultHandler(LogDomainVar *string, LogLevelVar LogLevelFlags, MessageVar *string, UnusedDataVar uintptr) {
220
221 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
222 defer core.GFreeNullable(LogDomainVarPtr)
223
224 MessageVarPtr := core.GStrdupNullable(MessageVar)
225 defer core.GFreeNullable(MessageVarPtr)
226
227 xLogDefaultHandler(LogDomainVarPtr, LogLevelVar, MessageVarPtr, UnusedDataVar)
228
229}
230
231var xLogGetAlwaysFatal func() LogLevelFlags
232
233// Gets the current fatal mask.
234//
235// This is mostly used by custom log writers to make fatal messages
236// (`fatal-warnings`, `fatal-criticals`) work as expected, when using the
237// `G_DEBUG` environment variable (see [Running GLib Applications](running.html)).
238//
239// An example usage is shown below:
240//
241// ```c
242// static GLogWriterOutput
243// my_custom_log_writer_fn (GLogLevelFlags log_level,
244//
245// const GLogField *fields,
246// gsize n_fields,
247// gpointer user_data)
248//
249// {
250//
251// // abort if the message was fatal
252// if (log_level & g_log_get_always_fatal ())
253// g_abort ();
254//
255// // custom log handling code
256// ...
257// ...
258//
259// // success
260// return G_LOG_WRITER_HANDLED;
261// }
262//
263// ```
264func LogGetAlwaysFatal() LogLevelFlags {
265
266 cret := xLogGetAlwaysFatal()
267
268 return cret
269}
270
271var xLogGetDebugEnabled func() bool
272
273// Return whether debug output from the GLib logging system is enabled.
274//
275// Note that this should not be used to conditionalise calls to [func@GLib.debug] or
276// other logging functions; it should only be used from [type@GLib.LogWriterFunc]
277// implementations.
278//
279// Note also that the value of this does not depend on `G_MESSAGES_DEBUG`, nor
280// `DEBUG_INVOCATION`, nor [func@GLib.log_writer_default_set_debug_domains]; see
281// the docs for [func@GLib.log_set_debug_enabled].
282func LogGetDebugEnabled() bool {
283
284 cret := xLogGetDebugEnabled()
285
286 return cret
287}
288
289var xLogRemoveHandler func(string, uint)
290
291// Removes the log handler.
292//
293// This has no effect if structured logging is enabled; see
294// [Using Structured Logging](logging.html#using-structured-logging).
295func LogRemoveHandler(LogDomainVar string, HandlerIdVar uint) {
296
297 xLogRemoveHandler(LogDomainVar, HandlerIdVar)
298
299}
300
301var xLogSetAlwaysFatal func(LogLevelFlags) LogLevelFlags
302
303// Sets the message levels which are always fatal, in any log domain.
304//
305// When a message with any of these levels is logged the program terminates.
306// You can only set the levels defined by GLib to be fatal.
307// [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal.
308//
309// You can also make some message levels fatal at runtime by setting
310// the `G_DEBUG` environment variable (see
311// [Running GLib Applications](running.html)).
312//
313// Libraries should not call this function, as it affects all messages logged
314// by a process, including those from other libraries.
315//
316// Structured log messages (using [func@GLib.log_structured] and
317// [func@GLib.log_structured_array]) are fatal only if the default log writer is used;
318// otherwise it is up to the writer function to determine which log messages
319// are fatal. See [Using Structured Logging](logging.html#using-structured-logging).
320func LogSetAlwaysFatal(FatalMaskVar LogLevelFlags) LogLevelFlags {
321
322 cret := xLogSetAlwaysFatal(FatalMaskVar)
323
324 return cret
325}
326
327var xLogSetDebugEnabled func(bool)
328
329// Enable or disable debug output from the GLib logging system for all domains.
330//
331// This value interacts disjunctively with `G_MESSAGES_DEBUG`, `DEBUG_INVOCATION` and
332// [func@GLib.log_writer_default_set_debug_domains] — if any of them would allow
333// a debug message to be outputted, it will be.
334//
335// Note that this should not be used from within library code to enable debug
336// output — it is intended for external use.
337func LogSetDebugEnabled(EnabledVar bool) {
338
339 xLogSetDebugEnabled(EnabledVar)
340
341}
342
343var xLogSetDefaultHandler func(uintptr, uintptr) uintptr
344
345// Installs a default log handler which is used if no
346// log handler has been set for the particular log domain
347// and log level combination.
348//
349// By default, GLib uses [func@GLib.log_default_handler] as default log handler.
350//
351// This has no effect if structured logging is enabled; see
352// [Using Structured Logging](logging.html#using-structured-logging).
353func LogSetDefaultHandler(LogFuncVar *LogFunc, UserDataVar uintptr) uintptr {
354
355 var LogFuncVarRef uintptr
356 if LogFuncVar != nil {
357 LogFuncVarPtr := uintptr(unsafe.Pointer(LogFuncVar))
358 if cbRefPtr, ok := GetCallback(LogFuncVarPtr); ok {
359 LogFuncVarRef = cbRefPtr
360 } else {
361 fcb := func(arg0 uintptr, arg1 LogLevelFlags, arg2 uintptr, arg3 uintptr) {
362 cbFn := *LogFuncVar
363 cbFn(core.GoString(arg0), arg1, core.GoString(arg2), arg3)
364 }
365 LogFuncVarRef = purego.NewCallback(fcb)
366 SaveCallbackWithClosure(LogFuncVarPtr, LogFuncVarRef, LogFuncVar)
367 }
368 }
369
370 cret := xLogSetDefaultHandler(LogFuncVarRef, UserDataVar)
371
372 return cret
373}
374
375var xLogSetFatalMask func(string, LogLevelFlags) LogLevelFlags
376
377// Sets the log levels which are fatal in the given domain.
378//
379// [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal.
380//
381// This has no effect on structured log messages (using [func@GLib.log_structured] or
382// [func@GLib.log_structured_array]). To change the fatal behaviour for specific log
383// messages, programs must install a custom log writer function using
384// [func@GLib.log_set_writer_func]. See
385// [Using Structured Logging](logging.html#using-structured-logging).
386//
387// This function is mostly intended to be used with
388// [flags@GLib.LogLevelFlags.LEVEL_CRITICAL]. You should typically not set
389// [flags@GLib.LogLevelFlags.LEVEL_WARNING], [flags@GLib.LogLevelFlags.LEVEL_MESSAGE], [flags@GLib.LogLevelFlags.LEVEL_INFO] or
390// [flags@GLib.LogLevelFlags.LEVEL_DEBUG] as fatal except inside of test programs.
391func LogSetFatalMask(LogDomainVar string, FatalMaskVar LogLevelFlags) LogLevelFlags {
392
393 cret := xLogSetFatalMask(LogDomainVar, FatalMaskVar)
394
395 return cret
396}
397
398var xLogSetHandler func(uintptr, LogLevelFlags, uintptr, uintptr) uint
399
400// Sets the log handler for a domain and a set of log levels.
401//
402// To handle fatal and recursive messages the @log_levels parameter
403// must be combined with the [flags@GLib.LogLevelFlags.FLAG_FATAL] and [flags@GLib.LogLevelFlags.FLAG_RECURSION]
404// bit flags.
405//
406// Note that since the [flags@GLib.LogLevelFlags.LEVEL_ERROR] log level is always fatal, if
407// you want to set a handler for this log level you must combine it with
408// [flags@GLib.LogLevelFlags.FLAG_FATAL].
409//
410// This has no effect if structured logging is enabled; see
411// [Using Structured Logging](logging.html#using-structured-logging).
412//
413// The `log_domain` parameter can be set to `NULL` or an empty string to use the default
414// application domain.
415//
416// Here is an example for adding a log handler for all warning messages
417// in the default domain:
418//
419// ```c
420// g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
421//
422// | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
423//
424// ```
425//
426// This example adds a log handler for all critical messages from GTK:
427//
428// ```c
429// g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
430//
431// | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
432//
433// ```
434//
435// This example adds a log handler for all messages from GLib:
436//
437// ```c
438// g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
439//
440// | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
441//
442// ```
443func LogSetHandler(LogDomainVar *string, LogLevelsVar LogLevelFlags, LogFuncVar *LogFunc, UserDataVar uintptr) uint {
444
445 var LogFuncVarRef uintptr
446 if LogFuncVar != nil {
447 LogFuncVarPtr := uintptr(unsafe.Pointer(LogFuncVar))
448 if cbRefPtr, ok := GetCallback(LogFuncVarPtr); ok {
449 LogFuncVarRef = cbRefPtr
450 } else {
451 fcb := func(arg0 uintptr, arg1 LogLevelFlags, arg2 uintptr, arg3 uintptr) {
452 cbFn := *LogFuncVar
453 cbFn(core.GoString(arg0), arg1, core.GoString(arg2), arg3)
454 }
455 LogFuncVarRef = purego.NewCallback(fcb)
456 SaveCallbackWithClosure(LogFuncVarPtr, LogFuncVarRef, LogFuncVar)
457 }
458 }
459
460 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
461 defer core.GFreeNullable(LogDomainVarPtr)
462
463 cret := xLogSetHandler(LogDomainVarPtr, LogLevelsVar, LogFuncVarRef, UserDataVar)
464
465 return cret
466}
467
468var xLogSetHandlerFull func(uintptr, LogLevelFlags, uintptr, uintptr, uintptr) uint
469
470// Like [func@GLib.log_set_handler], but takes a destroy notify for the @user_data.
471//
472// This has no effect if structured logging is enabled; see
473// [Using Structured Logging](logging.html#using-structured-logging).
474//
475// The `log_domain` parameter can be set to `NULL` or an empty string to use the default
476// application domain.
477func LogSetHandlerFull(LogDomainVar *string, LogLevelsVar LogLevelFlags, LogFuncVar *LogFunc, UserDataVar uintptr, DestroyVar *DestroyNotify) uint {
478
479 var LogFuncVarRef uintptr
480 if LogFuncVar != nil {
481 LogFuncVarPtr := uintptr(unsafe.Pointer(LogFuncVar))
482 if cbRefPtr, ok := GetCallback(LogFuncVarPtr); ok {
483 LogFuncVarRef = cbRefPtr
484 } else {
485 fcb := func(arg0 uintptr, arg1 LogLevelFlags, arg2 uintptr, arg3 uintptr) {
486 cbFn := *LogFuncVar
487 cbFn(core.GoString(arg0), arg1, core.GoString(arg2), arg3)
488 }
489 LogFuncVarRef = purego.NewCallback(fcb)
490 SaveCallbackWithClosure(LogFuncVarPtr, LogFuncVarRef, LogFuncVar)
491 }
492 }
493
494 var DestroyVarRef uintptr
495 if DestroyVar != nil {
496 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
497 if cbRefPtr, ok := GetCallback(DestroyVarPtr); ok {
498 DestroyVarRef = cbRefPtr
499 } else {
500 fcb := func(arg0 uintptr) {
501 cbFn := *DestroyVar
502 cbFn(arg0)
503 }
504 DestroyVarRef = purego.NewCallback(fcb)
505 SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
506 }
507 }
508
509 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
510 defer core.GFreeNullable(LogDomainVarPtr)
511
512 cret := xLogSetHandlerFull(LogDomainVarPtr, LogLevelsVar, LogFuncVarRef, UserDataVar, DestroyVarRef)
513
514 return cret
515}
516
517var xLogSetWriterFunc func(uintptr, uintptr, uintptr)
518
519// Set a writer function which will be called to format and write out each log
520// message.
521//
522// Each program should set a writer function, or the default writer
523// ([func@GLib.log_writer_default]) will be used.
524//
525// Libraries **must not** call this function — only programs are allowed to
526// install a writer function, as there must be a single, central point where
527// log messages are formatted and outputted.
528//
529// There can only be one writer function. It is an error to set more than one.
530func LogSetWriterFunc(FuncVar *LogWriterFunc, UserDataVar uintptr, UserDataFreeVar *DestroyNotify) {
531
532 var FuncVarRef uintptr
533 if FuncVar != nil {
534 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
535 if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
536 FuncVarRef = cbRefPtr
537 } else {
538 fcb := func(arg0 LogLevelFlags, arg1 []LogField, arg2 uint, arg3 uintptr) LogWriterOutput {
539 cbFn := *FuncVar
540 return cbFn(arg0, arg1, arg2, arg3)
541 }
542 FuncVarRef = purego.NewCallback(fcb)
543 SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
544 }
545 }
546
547 var UserDataFreeVarRef uintptr
548 if UserDataFreeVar != nil {
549 UserDataFreeVarPtr := uintptr(unsafe.Pointer(UserDataFreeVar))
550 if cbRefPtr, ok := GetCallback(UserDataFreeVarPtr); ok {
551 UserDataFreeVarRef = cbRefPtr
552 } else {
553 fcb := func(arg0 uintptr) {
554 cbFn := *UserDataFreeVar
555 cbFn(arg0)
556 }
557 UserDataFreeVarRef = purego.NewCallback(fcb)
558 SaveCallbackWithClosure(UserDataFreeVarPtr, UserDataFreeVarRef, UserDataFreeVar)
559 }
560 }
561
562 xLogSetWriterFunc(FuncVarRef, UserDataVar, UserDataFreeVarRef)
563
564}
565
566var xLogStructured func(string, LogLevelFlags, ...interface{})
567
568// Log a message with structured data.
569//
570// The message will be passed through to the log writer set by the application
571// using [func@GLib.log_set_writer_func]. If the message is fatal (i.e. its log level
572// is [flags@GLib.LogLevelFlags.LEVEL_ERROR]), the program will be aborted by calling
573// [func@GLib.BREAKPOINT] at the end of this function. If the log writer returns
574// [enum@GLib.LogWriterOutput.UNHANDLED] (failure), no other fallback writers will be tried.
575// See the documentation for [type@GLib.LogWriterFunc] for information on chaining
576// writers.
577//
578// The structured data is provided as key–value pairs, where keys are UTF-8
579// strings, and values are arbitrary pointers — typically pointing to UTF-8
580// strings, but that is not a requirement. To pass binary (non-nul-terminated)
581// structured data, use [func@GLib.log_structured_array]. The keys for structured data
582// should follow the [systemd journal
583// fields](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html)
584// specification. It is suggested that custom keys are namespaced according to
585// the code which sets them. For example, custom keys from GLib all have a
586// `GLIB_` prefix.
587//
588// Note that keys that expect UTF-8 strings (specifically `"MESSAGE"` and
589// `"GLIB_DOMAIN"`) must be passed as nul-terminated UTF-8 strings until GLib
590// version 2.74.1 because the default log handler did not consider the length of
591// the `GLogField`. Starting with GLib 2.74.1 this is fixed and
592// non-nul-terminated UTF-8 strings can be passed with their correct length,
593// with the exception of `"GLIB_DOMAIN"` which was only fixed with GLib 2.82.3.
594//
595// The @log_domain will be converted into a `GLIB_DOMAIN` field. @log_level will
596// be converted into a
597// [`PRIORITY`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#PRIORITY=)
598// field. The format string will have its placeholders substituted for the provided
599// values and be converted into a
600// [`MESSAGE`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE=)
601// field.
602//
603// Other fields you may commonly want to pass into this function:
604//
605// - [`MESSAGE_ID`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE_ID=)
606// - [`CODE_FILE`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_FILE=)
607// - [`CODE_LINE`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_LINE=)
608// - [`CODE_FUNC`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_FUNC=)
609// - [`ERRNO`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#ERRNO=)
610//
611// Note that `CODE_FILE`, `CODE_LINE` and `CODE_FUNC` are automatically set by
612// the logging macros, [func@GLib.DEBUG_HERE], [func@GLib.message], [func@GLib.warning], [func@GLib.critical],
613// [func@GLib.error], etc, if the symbol `G_LOG_USE_STRUCTURED` is defined before including
614// `glib.h`.
615//
616// For example:
617//
618// ```c
619// g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
620//
621// "MESSAGE_ID", "06d4df59e6c24647bfe69d2c27ef0b4e",
622// "MY_APPLICATION_CUSTOM_FIELD", "some debug string",
623// "MESSAGE", "This is a debug message about pointer %p and integer %u.",
624// some_pointer, some_integer);
625//
626// ```
627//
628// Note that each `MESSAGE_ID` must be [uniquely and randomly
629// generated](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE_ID=).
630// If adding a `MESSAGE_ID`, consider shipping a [message
631// catalog](https://www.freedesktop.org/wiki/Software/systemd/catalog/) with
632// your software.
633//
634// To pass a user data pointer to the log writer function which is specific to
635// this logging call, you must use [func@GLib.log_structured_array] and pass the pointer
636// as a field with `GLogField.length` set to zero, otherwise it will be
637// interpreted as a string.
638//
639// For example:
640//
641// ```c
642//
643// const GLogField fields[] = {
644// { "MESSAGE", "This is a debug message.", -1 },
645// { "MESSAGE_ID", "fcfb2e1e65c3494386b74878f1abf893", -1 },
646// { "MY_APPLICATION_CUSTOM_FIELD", "some debug string", -1 },
647// { "MY_APPLICATION_STATE", state_object, 0 },
648// };
649//
650// g_log_structured_array (G_LOG_LEVEL_DEBUG, fields, G_N_ELEMENTS (fields));
651// ```
652//
653// Note also that, even if no other structured fields are specified, there
654// must always be a `MESSAGE` key before the format string. The `MESSAGE`-format
655// pair has to be the last of the key-value pairs, and `MESSAGE` is the only
656// field for which `printf()`-style formatting is supported.
657//
658// The default writer function for `stdout` and `stderr` will automatically
659// append a new-line character after the message, so you should not add one
660// manually to the format string.
661func LogStructured(LogDomainVar string, LogLevelVar LogLevelFlags, varArgs ...interface{}) {
662
663 xLogStructured(LogDomainVar, LogLevelVar, varArgs...)
664
665}
666
667var xLogStructuredArray func(LogLevelFlags, []LogField, uint)
668
669// Log a message with structured data.
670//
671// The message will be passed through to the log writer set by the application
672// using [func@GLib.log_set_writer_func]. If the
673// message is fatal (i.e. its log level is [flags@GLib.LogLevelFlags.LEVEL_ERROR]), the program will
674// be aborted at the end of this function.
675//
676// See [func@GLib.log_structured] for more documentation.
677//
678// This assumes that @log_level is already present in @fields (typically as the
679// `PRIORITY` field).
680func LogStructuredArray(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint) {
681
682 xLogStructuredArray(LogLevelVar, FieldsVar, NFieldsVar)
683
684}
685
686var xLogStructuredStandard func(string, LogLevelFlags, string, string, string, string, ...interface{})
687
688func LogStructuredStandard(LogDomainVar string, LogLevelVar LogLevelFlags, FileVar string, LineVar string, FuncVar string, MessageFormatVar string, varArgs ...interface{}) {
689
690 xLogStructuredStandard(LogDomainVar, LogLevelVar, FileVar, LineVar, FuncVar, MessageFormatVar, varArgs...)
691
692}
693
694var xLogVariant func(uintptr, LogLevelFlags, *Variant)
695
696// Log a message with structured data, accepting the data within a [type@GLib.Variant].
697//
698// This version is especially useful for use in other languages, via introspection.
699//
700// The only mandatory item in the @fields dictionary is the `"MESSAGE"` which must
701// contain the text shown to the user.
702//
703// The values in the @fields dictionary are likely to be of type `G_VARIANT_TYPE_STRING`.
704// Array of bytes (`G_VARIANT_TYPE_BYTESTRING`) is also
705// supported. In this case the message is handled as binary and will be forwarded
706// to the log writer as such. The size of the array should not be higher than
707// `G_MAXSSIZE`. Otherwise it will be truncated to this size. For other types
708// [method@GLib.Variant.print] will be used to convert the value into a string.
709//
710// For more details on its usage and about the parameters, see [func@GLib.log_structured].
711func LogVariant(LogDomainVar *string, LogLevelVar LogLevelFlags, FieldsVar *Variant) {
712
713 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
714 defer core.GFreeNullable(LogDomainVarPtr)
715
716 xLogVariant(LogDomainVarPtr, LogLevelVar, FieldsVar)
717
718}
719
720var xLogWriterDefault func(LogLevelFlags, []LogField, uint, uintptr) LogWriterOutput
721
722// Format a structured log message and output it to the default log destination
723// for the platform.
724//
725// On Linux, this is typically the systemd journal, falling
726// back to `stdout` or `stderr` if running from the terminal or if output is
727// being redirected to a file.
728//
729// Support for other platform-specific logging mechanisms may be added in
730// future. Distributors of GLib may modify this function to impose their own
731// (documented) platform-specific log writing policies.
732//
733// This is suitable for use as a [type@GLib.LogWriterFunc], and is the default writer used
734// if no other is set using [func@GLib.log_set_writer_func].
735//
736// As with [func@GLib.log_default_handler], this function drops debug and informational
737// messages unless their log domain (or `all`) is listed in the space-separated
738// `G_MESSAGES_DEBUG` environment variable, or `DEBUG_INVOCATION=1` is set in
739// the environment, or set at runtime by [func@GLib.log_writer_default_set_debug_domains].
740//
741// [func@GLib.log_writer_default] uses the mask set by [func@GLib.log_set_always_fatal] to
742// determine which messages are fatal. When using a custom writer function instead it is
743// up to the writer function to determine which log messages are fatal.
744func LogWriterDefault(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint, UserDataVar uintptr) LogWriterOutput {
745
746 cret := xLogWriterDefault(LogLevelVar, FieldsVar, NFieldsVar, UserDataVar)
747
748 return cret
749}
750
751var xLogWriterDefaultSetDebugDomains func(uintptr)
752
753// Reset the list of domains to be logged, that might be initially set by the
754// `G_MESSAGES_DEBUG` or `DEBUG_INVOCATION` environment variables.
755//
756// This function is thread-safe.
757func LogWriterDefaultSetDebugDomains(DomainsVar *string) {
758
759 DomainsVarPtr := core.GStrdupNullable(DomainsVar)
760 defer core.GFreeNullable(DomainsVarPtr)
761
762 xLogWriterDefaultSetDebugDomains(DomainsVarPtr)
763
764}
765
766var xLogWriterDefaultSetUseStderr func(bool)
767
768// Configure whether the built-in log functions will output all log messages to
769// `stderr`.
770//
771// The built-in log functions are [func@GLib.log_default_handler] for the
772// old-style API, and both [func@GLib.log_writer_default] and
773// [func@GLib.log_writer_standard_streams] for the structured API.
774//
775// By default, log messages of levels [flags@GLib.LogLevelFlags.LEVEL_INFO] and
776// [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are sent to `stdout`, and other log messages are
777// sent to `stderr`. This is problematic for applications that intend
778// to reserve `stdout` for structured output such as JSON or XML.
779//
780// This function sets global state. It is not thread-aware, and should be
781// called at the very start of a program, before creating any other threads
782// or creating objects that could create worker threads of their own.
783func LogWriterDefaultSetUseStderr(UseStderrVar bool) {
784
785 xLogWriterDefaultSetUseStderr(UseStderrVar)
786
787}
788
789var xLogWriterDefaultWouldDrop func(LogLevelFlags, uintptr) bool
790
791// Check whether [func@GLib.log_writer_default] and [func@GLib.log_default_handler] would
792// ignore a message with the given domain and level.
793//
794// As with [func@GLib.log_default_handler], this function drops debug and informational
795// messages unless their log domain (or `all`) is listed in the space-separated
796// `G_MESSAGES_DEBUG` environment variable, or `DEBUG_INVOCATION=1` is set in
797// the environment, or by [func@GLib.log_writer_default_set_debug_domains].
798//
799// This can be used when implementing log writers with the same filtering
800// behaviour as the default, but a different destination or output format:
801//
802// ```c
803// if (g_log_writer_default_would_drop (log_level, log_domain))
804//
805// return G_LOG_WRITER_HANDLED;
806//
807// ]|
808//
809// or to skip an expensive computation if it is only needed for a debugging
810// message, and `G_MESSAGES_DEBUG` and `DEBUG_INVOCATION` are not set:
811//
812// ```c
813// if (!g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN))
814//
815// {
816// g_autofree gchar *result = expensive_computation (my_object);
817//
818// g_debug ("my_object result: %s", result);
819// }
820//
821// ```
822func LogWriterDefaultWouldDrop(LogLevelVar LogLevelFlags, LogDomainVar *string) bool {
823
824 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
825 defer core.GFreeNullable(LogDomainVarPtr)
826
827 cret := xLogWriterDefaultWouldDrop(LogLevelVar, LogDomainVarPtr)
828
829 return cret
830}
831
832var xLogWriterFormatFields func(LogLevelFlags, []LogField, uint, bool) string
833
834// Format a structured log message as a string suitable for outputting to the
835// terminal (or elsewhere).
836//
837// This will include the values of all fields it knows
838// how to interpret, which includes `MESSAGE` and `GLIB_DOMAIN` (see the
839// documentation for [func@GLib.log_structured]). It does not include values from
840// unknown fields.
841//
842// The returned string does **not** have a trailing new-line character. It is
843// encoded in the character set of the current locale, which is not necessarily
844// UTF-8.
845func LogWriterFormatFields(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint, UseColorVar bool) string {
846
847 cret := xLogWriterFormatFields(LogLevelVar, FieldsVar, NFieldsVar, UseColorVar)
848
849 return cret
850}
851
852var xLogWriterIsJournald func(int) bool
853
854// Check whether the given @output_fd file descriptor is a connection to the
855// systemd journal, or something else (like a log file or `stdout` or
856// `stderr`).
857//
858// Invalid file descriptors are accepted and return `FALSE`, which allows for
859// the following construct without needing any additional error handling:
860// ```c
861// is_journald = g_log_writer_is_journald (fileno (stderr));
862// ```
863func LogWriterIsJournald(OutputFdVar int) bool {
864
865 cret := xLogWriterIsJournald(OutputFdVar)
866
867 return cret
868}
869
870var xLogWriterJournald func(LogLevelFlags, []LogField, uint, uintptr) LogWriterOutput
871
872// Format a structured log message and send it to the systemd journal as a set
873// of key–value pairs.
874//
875// All fields are sent to the journal, but if a field has
876// length zero (indicating program-specific data) then only its key will be
877// sent.
878//
879// This is suitable for use as a [type@GLib.LogWriterFunc].
880//
881// If GLib has been compiled without systemd support, this function is still
882// defined, but will always return [enum@GLib.LogWriterOutput.UNHANDLED].
883func LogWriterJournald(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint, UserDataVar uintptr) LogWriterOutput {
884
885 cret := xLogWriterJournald(LogLevelVar, FieldsVar, NFieldsVar, UserDataVar)
886
887 return cret
888}
889
890var xLogWriterStandardStreams func(LogLevelFlags, []LogField, uint, uintptr) LogWriterOutput
891
892// Format a structured log message and print it to either `stdout` or `stderr`,
893// depending on its log level.
894//
895// [flags@GLib.LogLevelFlags.LEVEL_INFO] and [flags@GLib.LogLevelFlags.LEVEL_DEBUG] messages
896// are sent to `stdout`, or to `stderr` if requested by
897// [func@GLib.log_writer_default_set_use_stderr];
898// all other log levels are sent to `stderr`. Only fields
899// which are understood by this function are included in the formatted string
900// which is printed.
901//
902// If the output stream supports
903// [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code),
904// they will be used in the output.
905//
906// A trailing new-line character is added to the log message when it is printed.
907//
908// This is suitable for use as a [type@GLib.LogWriterFunc].
909func LogWriterStandardStreams(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint, UserDataVar uintptr) LogWriterOutput {
910
911 cret := xLogWriterStandardStreams(LogLevelVar, FieldsVar, NFieldsVar, UserDataVar)
912
913 return cret
914}
915
916var xLogWriterSupportsColor func(int) bool
917
918// Check whether the given @output_fd file descriptor supports
919// [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code).
920//
921// If so, they can safely be used when formatting log messages.
922func LogWriterSupportsColor(OutputFdVar int) bool {
923
924 cret := xLogWriterSupportsColor(OutputFdVar)
925
926 return cret
927}
928
929var xLogWriterSyslog func(LogLevelFlags, []LogField, uint, uintptr) LogWriterOutput
930
931// Format a structured log message and send it to the syslog daemon. Only fields
932// which are understood by this function are included in the formatted string
933// which is printed.
934//
935// Log facility will be defined via the SYSLOG_FACILITY field and accepts the following
936// values: "auth", "daemon", and "user". If SYSLOG_FACILITY is not specified, LOG_USER
937// facility will be used.
938//
939// This is suitable for use as a [type@GLib.LogWriterFunc].
940//
941// If syslog is not supported, this function is still defined, but will always
942// return [enum@GLib.LogWriterOutput.UNHANDLED].
943func LogWriterSyslog(LogLevelVar LogLevelFlags, FieldsVar []LogField, NFieldsVar uint, UserDataVar uintptr) LogWriterOutput {
944
945 cret := xLogWriterSyslog(LogLevelVar, FieldsVar, NFieldsVar, UserDataVar)
946
947 return cret
948}
949
950var xLogv func(uintptr, LogLevelFlags, string, []interface{})
951
952// Logs an error or debugging message.
953//
954// If the log level has been set as fatal, [func@GLib.BREAKPOINT] is called
955// to terminate the program. See the documentation for [func@GLib.BREAKPOINT] for
956// details of the debugging options this provides.
957//
958// If [func@GLib.log_default_handler] is used as the log handler function, a new-line
959// character will automatically be appended to @..., and need not be entered
960// manually.
961//
962// If [structured logging is enabled](logging.html#using-structured-logging) this will
963// output via the structured log writer function (see [func@GLib.log_set_writer_func]).
964//
965// The `log_domain` parameter can be set to `NULL` or an empty string to use the default
966// application domain.
967func Logv(LogDomainVar *string, LogLevelVar LogLevelFlags, FormatVar string, ArgsVar []interface{}) {
968
969 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
970 defer core.GFreeNullable(LogDomainVarPtr)
971
972 xLogv(LogDomainVarPtr, LogLevelVar, FormatVar, ArgsVar)
973
974}
975
976var xPrint func(string, ...interface{})
977
978// Outputs a formatted message via the print handler.
979//
980// The default print handler outputs the encoded message to `stdout`, without
981// appending a trailing new-line character. Typically, @format should end with
982// its own new-line character.
983//
984// This function should not be used from within libraries for debugging
985// messages, since it may be redirected by applications to special
986// purpose message windows or even files. Instead, libraries should
987// use [func@GLib.log], [func@GLib.log_structured], or the convenience macros
988// [func@GLib.message], [func@GLib.warning] and [func@GLib.error].
989func Print(FormatVar string, varArgs ...interface{}) {
990
991 xPrint(FormatVar, varArgs...)
992
993}
994
995var xPrinterr func(string, ...interface{})
996
997// Outputs a formatted message via the error message handler.
998//
999// The default handler outputs the encoded message to `stderr`, without appending
1000// a trailing new-line character. Typically, @format should end with its own
1001// new-line character.
1002//
1003// This function should not be used from within libraries.
1004// Instead [func@GLib.log] or [func@GLib.log_structured] should be used, or the convenience
1005// macros [func@GLib.message], [func@GLib.warning] and [func@GLib.error].
1006func Printerr(FormatVar string, varArgs ...interface{}) {
1007
1008 xPrinterr(FormatVar, varArgs...)
1009
1010}
1011
1012var xPrintfStringUpperBound func(string, []interface{}) uint
1013
1014// Calculates the maximum space needed to store the output
1015// of the `sprintf()` function.
1016//
1017// If @format or @args are invalid, `0` is returned. This could happen if, for
1018// example, @format contains an `%lc` or `%ls` placeholder and @args contains a
1019// wide character which cannot be represented in multibyte encoding. `0`
1020// can also be returned legitimately if, for example, @format is `%s` and @args
1021// is an empty string. The caller is responsible for differentiating these two
1022// return cases if necessary. It is recommended to not use `%lc` or `%ls`
1023// placeholders in any case, as their behaviour is locale-dependent.
1024func PrintfStringUpperBound(FormatVar string, ArgsVar []interface{}) uint {
1025
1026 cret := xPrintfStringUpperBound(FormatVar, ArgsVar)
1027
1028 return cret
1029}
1030
1031var xReturnIfFailWarning func(uintptr, string, uintptr)
1032
1033// Internal function used to print messages from the public [func@GLib.return_if_fail]
1034// and [func@GLib.return_val_if_fail] macros.
1035func ReturnIfFailWarning(LogDomainVar *string, PrettyFunctionVar string, ExpressionVar *string) {
1036
1037 LogDomainVarPtr := core.GStrdupNullable(LogDomainVar)
1038 defer core.GFreeNullable(LogDomainVarPtr)
1039
1040 ExpressionVarPtr := core.GStrdupNullable(ExpressionVar)
1041 defer core.GFreeNullable(ExpressionVarPtr)
1042
1043 xReturnIfFailWarning(LogDomainVarPtr, PrettyFunctionVar, ExpressionVarPtr)
1044
1045}
1046
1047var xSetPrintHandler func(uintptr) uintptr
1048
1049// Sets the print handler to @func, or resets it to the
1050// default GLib handler if `NULL`.
1051//
1052// Any messages passed to [func@GLib.print] will be output via
1053// the new handler. The default handler outputs
1054// the encoded message to `stdout`. By providing your own handler
1055// you can redirect the output, to a GTK widget or a
1056// log file for example.
1057//
1058// Since 2.76 this functions always returns a valid
1059// [type@GLib.PrintFunc], and never returns `NULL`. If no custom
1060// print handler was set, it will return the GLib
1061// default print handler and that can be re-used to
1062// decorate its output and/or to write to `stderr`
1063// in all platforms. Before GLib 2.76, this was `NULL`.
1064func SetPrintHandler(FuncVar *PrintFunc) uintptr {
1065
1066 var FuncVarRef uintptr
1067 if FuncVar != nil {
1068 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
1069 if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
1070 FuncVarRef = cbRefPtr
1071 } else {
1072 fcb := func(arg0 uintptr) {
1073 cbFn := *FuncVar
1074 cbFn(core.GoString(arg0))
1075 }
1076 FuncVarRef = purego.NewCallback(fcb)
1077 SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
1078 }
1079 }
1080
1081 cret := xSetPrintHandler(FuncVarRef)
1082
1083 return cret
1084}
1085
1086var xSetPrinterrHandler func(uintptr) uintptr
1087
1088// Sets the handler for printing error messages to @func,
1089// or resets it to the default GLib handler if `NULL`.
1090//
1091// Any messages passed to [func@GLib.printerr] will be output via
1092// the new handler. The default handler outputs the encoded
1093// message to `stderr`. By providing your own handler you can
1094// redirect the output, to a GTK widget or a log file for
1095// example.
1096//
1097// Since 2.76 this functions always returns a valid
1098// [type@GLib.PrintFunc], and never returns `NULL`. If no custom error
1099// print handler was set, it will return the GLib default
1100// error print handler and that can be re-used to decorate
1101// its output and/or to write to `stderr` in all platforms.
1102// Before GLib 2.76, this was `NULL`.
1103func SetPrinterrHandler(FuncVar *PrintFunc) uintptr {
1104
1105 var FuncVarRef uintptr
1106 if FuncVar != nil {
1107 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
1108 if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
1109 FuncVarRef = cbRefPtr
1110 } else {
1111 fcb := func(arg0 uintptr) {
1112 cbFn := *FuncVar
1113 cbFn(core.GoString(arg0))
1114 }
1115 FuncVarRef = purego.NewCallback(fcb)
1116 SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
1117 }
1118 }
1119
1120 cret := xSetPrinterrHandler(FuncVarRef)
1121
1122 return cret
1123}
1124
1125var xWarnMessage func(uintptr, string, int, string, uintptr)
1126
1127// Internal function used to print messages from the public [func@GLib.warn_if_reached]
1128// and [func@GLib.warn_if_fail] macros.
1129func WarnMessage(DomainVar *string, FileVar string, LineVar int, FuncVar string, WarnexprVar *string) {
1130
1131 DomainVarPtr := core.GStrdupNullable(DomainVar)
1132 defer core.GFreeNullable(DomainVarPtr)
1133
1134 WarnexprVarPtr := core.GStrdupNullable(WarnexprVar)
1135 defer core.GFreeNullable(WarnexprVarPtr)
1136
1137 xWarnMessage(DomainVarPtr, FileVar, LineVar, FuncVar, WarnexprVarPtr)
1138
1139}
1140
1141func init() {
1142 core.SetPackageName("GLIB", "glib-2.0")
1143 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
1144 var libs []uintptr
1145 for _, libPath := range core.GetPaths("GLIB") {
1146 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1147 if err != nil {
1148 panic(err)
1149 }
1150 libs = append(libs, lib)
1151 }
1152
1153 core.PuregoSafeRegister(&xAssertWarning, libs, "g_assert_warning")
1154 core.PuregoSafeRegister(&xLog, libs, "g_log")
1155 core.PuregoSafeRegister(&xLogDefaultHandler, libs, "g_log_default_handler")
1156 core.PuregoSafeRegister(&xLogGetAlwaysFatal, libs, "g_log_get_always_fatal")
1157 core.PuregoSafeRegister(&xLogGetDebugEnabled, libs, "g_log_get_debug_enabled")
1158 core.PuregoSafeRegister(&xLogRemoveHandler, libs, "g_log_remove_handler")
1159 core.PuregoSafeRegister(&xLogSetAlwaysFatal, libs, "g_log_set_always_fatal")
1160 core.PuregoSafeRegister(&xLogSetDebugEnabled, libs, "g_log_set_debug_enabled")
1161 core.PuregoSafeRegister(&xLogSetDefaultHandler, libs, "g_log_set_default_handler")
1162 core.PuregoSafeRegister(&xLogSetFatalMask, libs, "g_log_set_fatal_mask")
1163 core.PuregoSafeRegister(&xLogSetHandler, libs, "g_log_set_handler")
1164 core.PuregoSafeRegister(&xLogSetHandlerFull, libs, "g_log_set_handler_full")
1165 core.PuregoSafeRegister(&xLogSetWriterFunc, libs, "g_log_set_writer_func")
1166 core.PuregoSafeRegister(&xLogStructured, libs, "g_log_structured")
1167 core.PuregoSafeRegister(&xLogStructuredArray, libs, "g_log_structured_array")
1168 core.PuregoSafeRegister(&xLogStructuredStandard, libs, "g_log_structured_standard")
1169 core.PuregoSafeRegister(&xLogVariant, libs, "g_log_variant")
1170 core.PuregoSafeRegister(&xLogWriterDefault, libs, "g_log_writer_default")
1171 core.PuregoSafeRegister(&xLogWriterDefaultSetDebugDomains, libs, "g_log_writer_default_set_debug_domains")
1172 core.PuregoSafeRegister(&xLogWriterDefaultSetUseStderr, libs, "g_log_writer_default_set_use_stderr")
1173 core.PuregoSafeRegister(&xLogWriterDefaultWouldDrop, libs, "g_log_writer_default_would_drop")
1174 core.PuregoSafeRegister(&xLogWriterFormatFields, libs, "g_log_writer_format_fields")
1175 core.PuregoSafeRegister(&xLogWriterIsJournald, libs, "g_log_writer_is_journald")
1176 core.PuregoSafeRegister(&xLogWriterJournald, libs, "g_log_writer_journald")
1177 core.PuregoSafeRegister(&xLogWriterStandardStreams, libs, "g_log_writer_standard_streams")
1178 core.PuregoSafeRegister(&xLogWriterSupportsColor, libs, "g_log_writer_supports_color")
1179 core.PuregoSafeRegister(&xLogWriterSyslog, libs, "g_log_writer_syslog")
1180 core.PuregoSafeRegister(&xLogv, libs, "g_logv")
1181 core.PuregoSafeRegister(&xPrint, libs, "g_print")
1182 core.PuregoSafeRegister(&xPrinterr, libs, "g_printerr")
1183 core.PuregoSafeRegister(&xPrintfStringUpperBound, libs, "g_printf_string_upper_bound")
1184 core.PuregoSafeRegister(&xReturnIfFailWarning, libs, "g_return_if_fail_warning")
1185 core.PuregoSafeRegister(&xSetPrintHandler, libs, "g_set_print_handler")
1186 core.PuregoSafeRegister(&xSetPrinterrHandler, libs, "g_set_printerr_handler")
1187 core.PuregoSafeRegister(&xWarnMessage, libs, "g_warn_message")
1188
1189}