glib2 3.0.9-x86-mingw32 → 3.1.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/glib2/extconf.rb +0 -3
- data/ext/glib2/glib2.def +3 -0
- data/ext/glib2/rbglib.c +52 -20
- data/ext/glib2/rbglib.h +2 -2
- data/ext/glib2/rbglib_iochannel.c +1 -1
- data/ext/glib2/rbglib_mainloop.c +34 -11
- data/ext/glib2/rbglib_messages.c +21 -14
- data/ext/glib2/rbgobj_closure.c +65 -28
- data/ext/glib2/rbgobj_signal.c +38 -2
- data/ext/glib2/rbgobject.h +16 -0
- data/ext/glib2/rbgutil.c +6 -6
- data/lib/2.2/glib2.so +0 -0
- data/lib/2.3/glib2.so +0 -0
- data/lib/glib2.rb +8 -3
- data/lib/gnome2/rake/external-package.rb +24 -1
- data/lib/gnome2/rake/windows-binary-build-task.rb +339 -338
- data/vendor/local/bin/asn1Coding.exe +0 -0
- data/vendor/local/bin/asn1Decoding.exe +0 -0
- data/vendor/local/bin/asn1Parser.exe +0 -0
- data/vendor/local/bin/envsubst.exe +0 -0
- data/vendor/local/bin/gdbus.exe +0 -0
- data/vendor/local/bin/gettext.exe +0 -0
- data/vendor/local/bin/gio-querymodules.exe +0 -0
- data/vendor/local/bin/gio.exe +0 -0
- data/vendor/local/bin/glib-compile-resources.exe +0 -0
- data/vendor/local/bin/glib-compile-schemas.exe +0 -0
- data/vendor/local/bin/glib-genmarshal.exe +0 -0
- data/vendor/local/bin/glib-gettextize +1 -1
- data/vendor/local/bin/glib-mkenums +1 -1
- data/vendor/local/bin/gobject-query.exe +0 -0
- data/vendor/local/bin/gresource.exe +0 -0
- data/vendor/local/bin/gsettings.exe +0 -0
- data/vendor/local/bin/gspawn-win32-helper-console.exe +0 -0
- data/vendor/local/bin/gspawn-win32-helper.exe +0 -0
- data/vendor/local/bin/iconv.exe +0 -0
- data/vendor/local/bin/idn.exe +0 -0
- data/vendor/local/bin/libasprintf-0.dll +0 -0
- data/vendor/local/bin/libcharset-1.dll +0 -0
- data/vendor/local/bin/libffi-6.dll +0 -0
- data/vendor/local/bin/libgio-2.0-0.dll +0 -0
- data/vendor/local/bin/libglib-2.0-0.dll +0 -0
- data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
- data/vendor/local/bin/libgmp-10.dll +0 -0
- data/vendor/local/bin/libgnutls-30.dll +0 -0
- data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
- data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
- data/vendor/local/bin/libhogweed-4-2.dll +0 -0
- data/vendor/local/bin/libiconv-2.dll +0 -0
- data/vendor/local/bin/libidn-11.dll +0 -0
- data/vendor/local/bin/libintl-8.dll +0 -0
- data/vendor/local/bin/libnettle-6-2.dll +0 -0
- data/vendor/local/bin/libp11-kit-0.dll +0 -0
- data/vendor/local/bin/libpcre-1.dll +0 -0
- data/vendor/local/bin/libpcrecpp-0.dll +0 -0
- data/vendor/local/bin/libpcreposix-0.dll +0 -0
- data/vendor/local/bin/libtasn1-6.dll +0 -0
- data/vendor/local/bin/nettle-hash.exe +0 -0
- data/vendor/local/bin/nettle-lfib-stream.exe +0 -0
- data/vendor/local/bin/nettle-pbkdf2.exe +0 -0
- data/vendor/local/bin/ngettext.exe +0 -0
- data/vendor/local/bin/p11-kit.exe +0 -0
- data/vendor/local/bin/pcregrep.exe +0 -0
- data/vendor/local/bin/pcretest.exe +0 -0
- data/vendor/local/bin/pkcs1-conv.exe +0 -0
- data/vendor/local/bin/sexp-conv.exe +0 -0
- data/vendor/local/bin/trust.exe +0 -0
- data/vendor/local/include/glib-2.0/gio/gappinfo.h +11 -0
- data/vendor/local/include/glib-2.0/gio/gdrive.h +4 -0
- data/vendor/local/include/glib-2.0/gio/gfileinfo.h +9 -0
- data/vendor/local/include/glib-2.0/gio/gio-autocleanups.h +1 -0
- data/vendor/local/include/glib-2.0/gio/gioenums.h +10 -10
- data/vendor/local/include/glib-2.0/gio/giotypes.h +1 -1
- data/vendor/local/include/glib-2.0/gio/gsettings.h +14 -0
- data/vendor/local/include/glib-2.0/gio/gvfs.h +36 -0
- data/vendor/local/include/glib-2.0/glib/gchecksum.h +1 -1
- data/vendor/local/include/glib-2.0/glib/ghmac.h +5 -0
- data/vendor/local/include/glib-2.0/glib/gkeyfile.h +6 -0
- data/vendor/local/include/glib-2.0/glib/gmacros.h +1 -1
- data/vendor/local/include/glib-2.0/glib/gmain.h +11 -0
- data/vendor/local/include/glib-2.0/glib/gmessages.h +211 -2
- data/vendor/local/include/glib-2.0/glib/gtypes.h +2 -1
- data/vendor/local/include/glib-2.0/glib/gunicode.h +23 -3
- data/vendor/local/include/glib-2.0/glib/gutils.h +10 -0
- data/vendor/local/include/glib-2.0/glib/gvariant.h +71 -2
- data/vendor/local/include/glib-2.0/glib/gvarianttype.h +0 -1
- data/vendor/local/include/glib-2.0/glib/gversionmacros.h +23 -0
- data/vendor/local/include/glib-2.0/gobject/gparam.h +2 -1
- data/vendor/local/include/glib-2.0/gobject/gsignal.h +1 -1
- data/vendor/local/include/glib-2.0/gobject/gtypemodule.h +2 -0
- data/vendor/local/include/gmp.h +1 -1
- data/vendor/local/include/nettle/nettle-stdint.h +1 -1
- data/vendor/local/lib/gio/modules/libgiognutls.a +0 -0
- data/vendor/local/lib/gio/modules/libgiognutls.dll +0 -0
- data/vendor/local/lib/gio/modules/libgiognutls.dll.a +0 -0
- data/vendor/local/lib/glib-2.0/include/glibconfig.h +3 -2
- data/vendor/local/lib/libasprintf.a +0 -0
- data/vendor/local/lib/libasprintf.dll.a +0 -0
- data/vendor/local/lib/libcharset.a +0 -0
- data/vendor/local/lib/libcharset.dll.a +0 -0
- data/vendor/local/lib/libffi.a +0 -0
- data/vendor/local/lib/libffi.dll.a +0 -0
- data/vendor/local/lib/libgio-2.0.dll.a +0 -0
- data/vendor/local/lib/libgio-2.0.la +5 -5
- data/vendor/local/lib/libglib-2.0.dll.a +0 -0
- data/vendor/local/lib/libglib-2.0.la +5 -5
- data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
- data/vendor/local/lib/libgmodule-2.0.la +5 -5
- data/vendor/local/lib/libgmp.dll.a +0 -0
- data/vendor/local/lib/libgnutls.dll.a +0 -0
- data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
- data/vendor/local/lib/libgobject-2.0.la +5 -5
- data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
- data/vendor/local/lib/libgthread-2.0.la +5 -5
- data/vendor/local/lib/libhogweed.a +0 -0
- data/vendor/local/lib/libhogweed.dll.a +0 -0
- data/vendor/local/lib/libiconv.dll.a +0 -0
- data/vendor/local/lib/libidn.a +0 -0
- data/vendor/local/lib/libidn.dll.a +0 -0
- data/vendor/local/lib/libintl.a +0 -0
- data/vendor/local/lib/libintl.dll.a +0 -0
- data/vendor/local/lib/libnettle.a +0 -0
- data/vendor/local/lib/libnettle.dll.a +0 -0
- data/vendor/local/lib/libp11-kit.dll.a +0 -0
- data/vendor/local/lib/libpcre.a +0 -0
- data/vendor/local/lib/libpcre.dll.a +0 -0
- data/vendor/local/lib/libpcrecpp.a +0 -0
- data/vendor/local/lib/libpcrecpp.dll.a +0 -0
- data/vendor/local/lib/libpcreposix.a +0 -0
- data/vendor/local/lib/libpcreposix.dll.a +0 -0
- data/vendor/local/lib/libtasn1.a +0 -0
- data/vendor/local/lib/libtasn1.dll.a +0 -0
- data/vendor/local/lib/p11-kit/p11-kit-remote.exe +0 -0
- data/vendor/local/lib/pkcs11/p11-kit-trust.dll +0 -0
- data/vendor/local/lib/pkcs11/p11-kit-trust.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/gio-2.0.pc +2 -2
- data/vendor/local/lib/pkgconfig/gio-windows-2.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/glib-2.0.pc +2 -2
- data/vendor/local/lib/pkgconfig/gmodule-2.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gnutls.pc +1 -1
- data/vendor/local/lib/pkgconfig/gobject-2.0.pc +2 -2
- data/vendor/local/lib/pkgconfig/gthread-2.0.pc +1 -1
- data/vendor/local/share/bash-completion/completions/gsettings +3 -3
- data/vendor/local/share/gdb/auto-load/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/lib/{libglib-2.0.so.0.4800.1-gdb.py → libglib-2.0.so.0.5000.2-gdb.py} +1 -1
- data/vendor/local/share/gdb/auto-load/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/lib/{libgobject-2.0.so.0.4800.1-gdb.py → libgobject-2.0.so.0.5000.2-gdb.py} +1 -1
- data/vendor/local/share/glib-2.0/codegen/__init__.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/__init__.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen.py +32 -22
- data/vendor/local/share/glib-2.0/codegen/codegen.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_docbook.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_docbook.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_main.py +3 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_main.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_main.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/config.py +1 -1
- data/vendor/local/share/glib-2.0/codegen/config.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/config.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/dbustypes.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/dbustypes.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/parser.py +8 -4
- data/vendor/local/share/glib-2.0/codegen/parser.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/parser.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/utils.py +8 -2
- data/vendor/local/share/glib-2.0/codegen/utils.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/utils.pyo +0 -0
- data/vendor/local/share/glib-2.0/gdb/{glib.py → glib_gdb.py} +0 -0
- data/vendor/local/share/glib-2.0/gdb/{gobject.py → gobject_gdb.py} +3 -3
- data/vendor/local/share/gtk-doc/html/gio/GAction.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GActionGroup.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GActionMap.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GAppInfo.html +115 -8
- data/vendor/local/share/gtk-doc/html/gio/GApplication.html +4 -4
- data/vendor/local/share/gtk-doc/html/gio/GApplicationCommandLine.html +2 -1
- data/vendor/local/share/gtk-doc/html/gio/GAsyncInitable.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GAsyncResult.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GCancellable.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GConverter.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GCredentials.html +5 -5
- data/vendor/local/share/gtk-doc/html/gio/GDBusInterface.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDBusMessage.html +6 -6
- data/vendor/local/share/gtk-doc/html/gio/GDBusObject.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDBusObjectManager.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDBusObjectManagerClient.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDBusObjectManagerServer.html +3 -3
- data/vendor/local/share/gtk-doc/html/gio/GDatagramBased.html +8 -7
- data/vendor/local/share/gtk-doc/html/gio/GDrive.html +44 -1
- data/vendor/local/share/gtk-doc/html/gio/GDtlsClientConnection.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDtlsConnection.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GDtlsServerConnection.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GFile.html +25 -23
- data/vendor/local/share/gtk-doc/html/gio/GFileDescriptorBased.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GFileEnumerator.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GFileInfo.html +18 -4
- data/vendor/local/share/gtk-doc/html/gio/GFileMonitor.html +5 -5
- data/vendor/local/share/gtk-doc/html/gio/GIOModule.html +14 -10
- data/vendor/local/share/gtk-doc/html/gio/GIcon.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GInetSocketAddress.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GInitable.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GListModel.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GLoadableIcon.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GMenu.html +14 -14
- data/vendor/local/share/gtk-doc/html/gio/GMenuModel.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GMount.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GMountOperation.html +5 -5
- data/vendor/local/share/gtk-doc/html/gio/GNetworkMonitor.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GPollableInputStream.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GPollableOutputStream.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GPropertyAction.html +4 -4
- data/vendor/local/share/gtk-doc/html/gio/GProxy.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GProxyResolver.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GRemoteActionGroup.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GResolver.html +2 -0
- data/vendor/local/share/gtk-doc/html/gio/GResource.html +32 -2
- data/vendor/local/share/gtk-doc/html/gio/GSeekable.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GSettings.html +234 -11
- data/vendor/local/share/gtk-doc/html/gio/GSimpleAsyncResult.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GSocketConnectable.html +3 -3
- data/vendor/local/share/gtk-doc/html/gio/GSocketService.html +10 -2
- data/vendor/local/share/gtk-doc/html/gio/GSrvTarget.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GSubprocessLauncher.html +9 -9
- data/vendor/local/share/gtk-doc/html/gio/GTask.html +6 -6
- data/vendor/local/share/gtk-doc/html/gio/GThemedIcon.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GTlsBackend.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GTlsCertificate.html +10 -9
- data/vendor/local/share/gtk-doc/html/gio/GTlsClientConnection.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GTlsFileDatabase.html +3 -3
- data/vendor/local/share/gtk-doc/html/gio/GTlsServerConnection.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/GVfs.html +222 -0
- data/vendor/local/share/gtk-doc/html/gio/GVolume.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/annotation-glossary.html +4 -2
- data/vendor/local/share/gtk-doc/html/gio/api-index-2-48.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/api-index-2-50.html +79 -0
- data/vendor/local/share/gtk-doc/html/gio/api-index-full.html +44 -0
- data/vendor/local/share/gtk-doc/html/gio/ch33.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/ch35.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/extending-gio.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/gapplication-tool.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/gdbus-codegen.html +18 -6
- data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Introspection-Data.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html +7 -4
- data/vendor/local/share/gtk-doc/html/gio/gio-GFileAttribute.html +1 -1
- data/vendor/local/share/gtk-doc/html/gio/gio-GSettingsSchema-GSettingsSchemaSource.html +3 -3
- data/vendor/local/share/gtk-doc/html/gio/gio-GWin32RegistryKey.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/gio-Unix-Mounts.html +10 -6
- data/vendor/local/share/gtk-doc/html/gio/gio-hierarchy.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/gio.devhelp2 +14 -0
- data/vendor/local/share/gtk-doc/html/gio/gio.html +664 -0
- data/vendor/local/share/gtk-doc/html/gio/glib-compile-resources.html +19 -0
- data/vendor/local/share/gtk-doc/html/gio/glib-compile-schemas.html +6 -0
- data/vendor/local/share/gtk-doc/html/gio/gsettings-tool.html +7 -0
- data/vendor/local/share/gtk-doc/html/gio/index.html +5 -1
- data/vendor/local/share/gtk-doc/html/gio/pt02.html +3 -0
- data/vendor/local/share/gtk-doc/html/gio/running-gio-apps.html +10 -9
- data/vendor/local/share/gtk-doc/html/gio/testing.html +2 -2
- data/vendor/local/share/gtk-doc/html/gio/tools.html +3 -0
- data/vendor/local/share/gtk-doc/html/glib/annotation-glossary.html +4 -2
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-16.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-40.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-46.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-48.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-50.html +121 -0
- data/vendor/local/share/gtk-doc/html/glib/api-index-2-6.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/api-index-full.html +110 -34
- data/vendor/local/share/gtk-doc/html/glib/glib-Arrays.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-Bookmark-file-parser.html +10 -9
- data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Arrays.html +4 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-Character-Set-Conversion.html +10 -8
- data/vendor/local/share/gtk-doc/html/glib/glib-Commandline-option-parser.html +8 -8
- data/vendor/local/share/gtk-doc/html/glib/glib-Data-Checksums.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-Data-HMACs.html +56 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-Dynamic-Loading-of-Modules.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-Error-Reporting.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-File-Utilities.html +71 -50
- data/vendor/local/share/gtk-doc/html/glib/glib-GVariant.html +74 -17
- data/vendor/local/share/gtk-doc/html/glib/glib-GVariantType.html +4 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-I18N.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-IO-Channels.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-Key-value-file-parser.html +57 -0
- data/vendor/local/share/gtk-doc/html/glib/glib-Keyed-Data-Lists.html +3 -3
- data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocation.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-Message-Logging.html +1009 -13
- data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Macros.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Utility-Functions.html +84 -56
- data/vendor/local/share/gtk-doc/html/glib/glib-Perl-compatible-regular-expressions.html +3 -0
- data/vendor/local/share/gtk-doc/html/glib/glib-Simple-XML-Subset-Parser.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-Spawning-Processes.html +4 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-String-Utility-Functions.html +2 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-Testing.html +27 -13
- data/vendor/local/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html +36 -14
- data/vendor/local/share/gtk-doc/html/glib/glib-Threads.html +4 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-UNIX-specific-utilities-and-integration.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-URI-Functions.html +4 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html +68 -5
- data/vendor/local/share/gtk-doc/html/glib/glib-Version-Information.html +17 -4
- data/vendor/local/share/gtk-doc/html/glib/glib-Warnings-and-Assertions.html +12 -23
- data/vendor/local/share/gtk-doc/html/glib/glib-Windows-Compatibility-Functions.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-core.html +2 -3
- data/vendor/local/share/gtk-doc/html/glib/glib-regex-syntax.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib-running.html +3 -2
- data/vendor/local/share/gtk-doc/html/glib/glib-utilities.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/glib.devhelp2 +36 -2
- data/vendor/local/share/gtk-doc/html/glib/gvariant-format-strings.html +6 -6
- data/vendor/local/share/gtk-doc/html/glib/gvariant-text.html +1 -1
- data/vendor/local/share/gtk-doc/html/glib/index.html +4 -4
- data/vendor/local/share/gtk-doc/html/gobject/GTypePlugin.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/chapter-gtype.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/gobject-Closures.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/gobject-Generic-values.html +3 -3
- data/vendor/local/share/gtk-doc/html/gobject/gobject-Signals.html +2 -2
- data/vendor/local/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html +2 -2
- data/vendor/local/share/gtk-doc/html/gobject/gobject-properties.html +2 -2
- data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-construction.html +2 -2
- data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-destruction.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/index.html +1 -1
- data/vendor/local/share/gtk-doc/html/gobject/tools-gtkdoc.html +1 -1
- data/vendor/local/share/gtk-doc/html/p11-kit/p11-kit-Future.html +4 -4
- data/vendor/local/share/gtk-doc/html/p11-kit/p11-kit-Modules.html +12 -12
- data/vendor/local/share/gtk-doc/html/p11-kit/p11-kit-PIN-Callbacks.html +15 -15
- data/vendor/local/share/gtk-doc/html/p11-kit/p11-kit-URIs.html +2 -2
- data/vendor/local/share/gtk-doc/html/p11-kit/p11-kit-Utilities.html +2 -2
- data/vendor/local/share/locale/az/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/be@latin/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/bn_IN/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/ca/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/ca@valencia/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/ca@valencia/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/cs/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/da/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/de/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/de/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/dz/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/en@shaw/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/en_CA/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/en_CA/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/en_GB/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/en_GB/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/eo/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/es/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/es/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/eu/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/fa/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/fa/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/fi/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/fr/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/fr/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/gl/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/gu/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/gu/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/he/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/hr/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/hu/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/hu/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/id/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/it/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/it/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/kk/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/km/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/kn/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/ko/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/lt/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/lt/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/lv/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/mai/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/mg/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/ml/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/ms/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/nb/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/nb/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/nds/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/oc/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/oc/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/pa/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/pl/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/pl/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/pt/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/pt_BR/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sk/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sl/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/sl/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sq/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sr/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sr@ije/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/sv/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/th/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/tr/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/tt/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/ug/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/ug/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/wa/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/zh_CN/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/zh_HK/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/zh_HK/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/locale/zh_TW/LC_MESSAGES/glib-networking.mo +0 -0
- data/vendor/local/share/locale/zh_TW/LC_MESSAGES/glib20.mo +0 -0
- data/vendor/local/share/man/man1/gapplication.1 +1 -1
- data/vendor/local/share/man/man1/gdbus-codegen.1 +8 -3
- data/vendor/local/share/man/man1/gdbus.1 +1 -1
- data/vendor/local/share/man/man1/gio-querymodules.1 +1 -1
- data/vendor/local/share/man/man1/gio.1 +583 -0
- data/vendor/local/share/man/man1/glib-compile-resources.1 +19 -1
- data/vendor/local/share/man/man1/glib-compile-schemas.1 +6 -1
- data/vendor/local/share/man/man1/glib-genmarshal.1 +1 -1
- data/vendor/local/share/man/man1/glib-gettextize.1 +1 -1
- data/vendor/local/share/man/man1/glib-mkenums.1 +1 -1
- data/vendor/local/share/man/man1/gobject-query.1 +1 -1
- data/vendor/local/share/man/man1/gresource.1 +1 -1
- data/vendor/local/share/man/man1/gsettings.1 +9 -1
- data/vendor/local/share/man/man1/gtester-report.1 +1 -1
- data/vendor/local/share/man/man1/gtester.1 +1 -1
- metadata +12 -7
@@ -769,6 +769,12 @@
|
|
769
769
|
</td>
|
770
770
|
</tr>
|
771
771
|
<tr>
|
772
|
+
<td class="define_keyword">#define</td>
|
773
|
+
<td class="function_name">
|
774
|
+
<a class="link" href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS" title="G_VARIANT_BUILDER_INIT()">G_VARIANT_BUILDER_INIT</a><span class="c_punctuation">()</span>
|
775
|
+
</td>
|
776
|
+
</tr>
|
777
|
+
<tr>
|
772
778
|
<td class="function_type">
|
773
779
|
<span class="returnvalue">void</span>
|
774
780
|
</td>
|
@@ -1050,7 +1056,7 @@ can use:</p>
|
|
1050
1056
|
<tbody>
|
1051
1057
|
<tr>
|
1052
1058
|
<td class="listing_lines" align="right"><pre>1</pre></td>
|
1053
|
-
<td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>v <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string"
|
1059
|
+
<td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>v <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">'u'</span><span class="gtkdoc opt">,</span> <span class="number">40</span><span class="gtkdoc opt">);</span></pre></td>
|
1054
1060
|
</tr>
|
1055
1061
|
</tbody>
|
1056
1062
|
</table>
|
@@ -1081,7 +1087,7 @@ Serialised <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><
|
|
1081
1087
|
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is largely compatible with D-Bus. Almost all types of
|
1082
1088
|
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances can be sent over D-Bus. See <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> for
|
1083
1089
|
exceptions. (However, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>'s serialisation format is not the same
|
1084
|
-
as the serialisation format of a D-Bus message body: use <a href="
|
1090
|
+
as the serialisation format of a D-Bus message body: use <a href="https://developer.gnome.org/gio/unstable/GDBusMessage.html#GDBusMessage-struct"><span class="type">GDBusMessage</span></a>,
|
1085
1091
|
in the gio library, for those.)</p>
|
1086
1092
|
<p>For space-efficiency, the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> serialisation format does not
|
1087
1093
|
automatically include the variant's length, type or endianness,
|
@@ -1674,7 +1680,7 @@ the data inside of the soon-to-be-freed <a class="link" href="glib-GVariant.html
|
|
1674
1680
|
check fails then a <a class="link" href="glib-Message-Logging.html#g-critical" title="g_critical()"><code class="function">g_critical()</code></a> is printed and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is returned.</p>
|
1675
1681
|
<p>This function is meant to be used by functions that wish to provide
|
1676
1682
|
varargs accessors to <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> values of uncertain values (eg:
|
1677
|
-
<a class="link" href="glib-GVariant.html#g-variant-lookup" title="g_variant_lookup ()"><code class="function">g_variant_lookup()</code></a> or <a href="
|
1683
|
+
<a class="link" href="glib-GVariant.html#g-variant-lookup" title="g_variant_lookup ()"><code class="function">g_variant_lookup()</code></a> or <a href="https://developer.gnome.org/gio/unstable/GMenuModel.html#g-menu-model-get-item-attribute"><code class="function">g_menu_model_get_item_attribute()</code></a>).</p>
|
1678
1684
|
<div class="refsect3">
|
1679
1685
|
<a name="g-variant-check-format-string.parameters"></a><h4>Parameters</h4>
|
1680
1686
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -3338,6 +3344,8 @@ non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><cod
|
|
3338
3344
|
<p>If the array contains a nul terminator character somewhere other than
|
3339
3345
|
the last byte then the returned string is the string, up to the first
|
3340
3346
|
such nul character.</p>
|
3347
|
+
<p>g_variant_get_fixed_array() should be used instead if the array contains
|
3348
|
+
arbitrary data that could not be nul-terminated or could contain nul bytes.</p>
|
3341
3349
|
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
|
3342
3350
|
that is not an
|
3343
3351
|
array of bytes.</p>
|
@@ -4930,7 +4938,7 @@ you no longer need it.</p>
|
|
4930
4938
|
<span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">,</span> container<span class="gtkdoc opt">);</span>
|
4931
4939
|
<span class="keyword">while</span> <span class="gtkdoc opt">((</span>child <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-iter-next-value">g_variant_iter_next_value</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">)))</span>
|
4932
4940
|
<span class="gtkdoc opt">{</span>
|
4933
|
-
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"type
|
4941
|
+
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"type '%s'</span><span class="gtkdoc esc">\n</span><span class="string">"</span><span class="gtkdoc opt">,</span> <span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span> <span class="gtkdoc opt">(</span>child<span class="gtkdoc opt">));</span>
|
4934
4942
|
|
4935
4943
|
<span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariant.html#g-variant-is-container">g_variant_is_container</a></span> <span class="gtkdoc opt">(</span>child<span class="gtkdoc opt">))</span>
|
4936
4944
|
<span class="function">iterate_container_recursive</span> <span class="gtkdoc opt">(</span>child<span class="gtkdoc opt">);</span>
|
@@ -5005,7 +5013,7 @@ the unpacking process.</p>
|
|
5005
5013
|
17
|
5006
5014
|
18
|
5007
5015
|
19</pre></td>
|
5008
|
-
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// Iterates a dictionary of type
|
5016
|
+
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// Iterates a dictionary of type 'a{sv}'</span>
|
5009
5017
|
<span class="gtkdoc kwb">void</span>
|
5010
5018
|
<span class="function">iterate_dictionary</span> <span class="gtkdoc opt">(</span>GVariant <span class="gtkdoc opt">*</span>dictionary<span class="gtkdoc opt">)</span>
|
5011
5019
|
<span class="gtkdoc opt">{</span>
|
@@ -5016,7 +5024,7 @@ the unpacking process.</p>
|
|
5016
5024
|
<span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">,</span> dictionary<span class="gtkdoc opt">);</span>
|
5017
5025
|
<span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariant.html#g-variant-iter-next">g_variant_iter_next</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">,</span> <span class="string">"{sv}"</span><span class="gtkdoc opt">, &</span>key<span class="gtkdoc opt">, &</span>value<span class="gtkdoc opt">))</span>
|
5018
5026
|
<span class="gtkdoc opt">{</span>
|
5019
|
-
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"Item
|
5027
|
+
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"Item '%s' has type '%s'</span><span class="gtkdoc esc">\n</span><span class="string">"</span><span class="gtkdoc opt">,</span> key<span class="gtkdoc opt">,</span>
|
5020
5028
|
<span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">));</span>
|
5021
5029
|
|
5022
5030
|
<span class="gtkdoc slc">// must free data for ourselves</span>
|
@@ -5121,7 +5129,7 @@ you must free or unreference all the unpacked values as you would with
|
|
5121
5129
|
16
|
5122
5130
|
17
|
5123
5131
|
18</pre></td>
|
5124
|
-
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// Iterates a dictionary of type
|
5132
|
+
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// Iterates a dictionary of type 'a{sv}'</span>
|
5125
5133
|
<span class="gtkdoc kwb">void</span>
|
5126
5134
|
<span class="function">iterate_dictionary</span> <span class="gtkdoc opt">(</span>GVariant <span class="gtkdoc opt">*</span>dictionary<span class="gtkdoc opt">)</span>
|
5127
5135
|
<span class="gtkdoc opt">{</span>
|
@@ -5132,10 +5140,10 @@ you must free or unreference all the unpacked values as you would with
|
|
5132
5140
|
<span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">,</span> dictionary<span class="gtkdoc opt">);</span>
|
5133
5141
|
<span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariant.html#g-variant-iter-loop">g_variant_iter_loop</a></span> <span class="gtkdoc opt">(&</span>iter<span class="gtkdoc opt">,</span> <span class="string">"{sv}"</span><span class="gtkdoc opt">, &</span>key<span class="gtkdoc opt">, &</span>value<span class="gtkdoc opt">))</span>
|
5134
5142
|
<span class="gtkdoc opt">{</span>
|
5135
|
-
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"Item
|
5143
|
+
<span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">"Item '%s' has type '%s'</span><span class="gtkdoc esc">\n</span><span class="string">"</span><span class="gtkdoc opt">,</span> key<span class="gtkdoc opt">,</span>
|
5136
5144
|
<span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">));</span>
|
5137
5145
|
|
5138
|
-
<span class="gtkdoc slc">// no need to free
|
5146
|
+
<span class="gtkdoc slc">// no need to free 'key' and 'value' here</span>
|
5139
5147
|
<span class="gtkdoc slc">// unless breaking out of this loop</span>
|
5140
5148
|
<span class="gtkdoc opt">}</span>
|
5141
5149
|
<span class="gtkdoc opt">}</span></pre></td>
|
@@ -5195,6 +5203,52 @@ value</p>
|
|
5195
5203
|
</div>
|
5196
5204
|
<hr>
|
5197
5205
|
<div class="refsect2">
|
5206
|
+
<a name="G-VARIANT-BUILDER-INIT:CAPS"></a><h3>G_VARIANT_BUILDER_INIT()</h3>
|
5207
|
+
<pre class="programlisting">#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } }
|
5208
|
+
</pre>
|
5209
|
+
<p>A stack-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> must be initialized if it is
|
5210
|
+
used together with <a class="link" href="glib-Miscellaneous-Macros.html#g-auto" title="g_auto()"><code class="function">g_auto()</code></a> to avoid warnings or crashes if
|
5211
|
+
function returns before <a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a> is called on the
|
5212
|
+
builder. This macro can be used as initializer instead of an
|
5213
|
+
explicit zeroing a variable when declaring it and a following
|
5214
|
+
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a>, but it cannot be assigned to a variable.</p>
|
5215
|
+
<p>The passed <em class="parameter"><code>variant_type</code></em>
|
5216
|
+
should be a static GVariantType to avoid
|
5217
|
+
lifetime issues, as copying the <em class="parameter"><code>variant_type</code></em>
|
5218
|
+
does not happen in
|
5219
|
+
the <a class="link" href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS" title="G_VARIANT_BUILDER_INIT()"><code class="function">G_VARIANT_BUILDER_INIT()</code></a> call, but rather in functions that
|
5220
|
+
make sure that <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> is valid.</p>
|
5221
|
+
<div class="informalexample">
|
5222
|
+
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
5223
|
+
<tbody>
|
5224
|
+
<tr>
|
5225
|
+
<td class="listing_lines" align="right"><pre>1</pre></td>
|
5226
|
+
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-Miscellaneous-Macros.html#g-auto">g_auto</a></span><span class="gtkdoc opt">(</span>GVariantBuilder<span class="gtkdoc opt">)</span> builder <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS">G_VARIANT_BUILDER_INIT</a></span> <span class="gtkdoc opt">(</span>G_VARIANT_TYPE_BYTESTRING<span class="gtkdoc opt">);</span></pre></td>
|
5227
|
+
</tr>
|
5228
|
+
</tbody>
|
5229
|
+
</table>
|
5230
|
+
</div>
|
5231
|
+
|
5232
|
+
<p></p>
|
5233
|
+
<div class="refsect3">
|
5234
|
+
<a name="G-VARIANT-BUILDER-INIT.parameters"></a><h4>Parameters</h4>
|
5235
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
5236
|
+
<colgroup>
|
5237
|
+
<col width="150px" class="parameters_name">
|
5238
|
+
<col class="parameters_description">
|
5239
|
+
<col width="200px" class="parameters_annotations">
|
5240
|
+
</colgroup>
|
5241
|
+
<tbody><tr>
|
5242
|
+
<td class="parameter_name"><p>variant_type</p></td>
|
5243
|
+
<td class="parameter_description"><p>a const GVariantType*</p></td>
|
5244
|
+
<td class="parameter_annotations"> </td>
|
5245
|
+
</tr></tbody>
|
5246
|
+
</table></div>
|
5247
|
+
</div>
|
5248
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
5249
|
+
</div>
|
5250
|
+
<hr>
|
5251
|
+
<div class="refsect2">
|
5198
5252
|
<a name="g-variant-builder-unref"></a><h3>g_variant_builder_unref ()</h3>
|
5199
5253
|
<pre class="programlisting"><span class="returnvalue">void</span>
|
5200
5254
|
g_variant_builder_unref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
|
@@ -5551,9 +5605,9 @@ the GVariant varargs documentation.</p>
|
|
5551
5605
|
<span class="gtkdoc kwb">int</span> i<span class="gtkdoc opt">;</span>
|
5552
5606
|
|
5553
5607
|
<span class="function"><a href="glib-GVariant.html#g-variant-builder-init">g_variant_builder_init</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> G_VARIANT_TYPE_ARRAY<span class="gtkdoc opt">);</span>
|
5554
|
-
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{
|
5555
|
-
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{
|
5556
|
-
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{
|
5608
|
+
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{'width', <%i>}"</span><span class="gtkdoc opt">,</span> <span class="number">600</span><span class="gtkdoc opt">);</span>
|
5609
|
+
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{'title', <%s>}"</span><span class="gtkdoc opt">,</span> <span class="string">"foo"</span><span class="gtkdoc opt">);</span>
|
5610
|
+
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">,</span> <span class="string">"{'transparency', <0.5>}"</span><span class="gtkdoc opt">);</span>
|
5557
5611
|
<span class="keyword">return</span> <span class="function"><a href="glib-GVariant.html#g-variant-builder-end">g_variant_builder_end</a></span> <span class="gtkdoc opt">(&</span>builder<span class="gtkdoc opt">);</span>
|
5558
5612
|
<span class="gtkdoc opt">}</span></pre></td>
|
5559
5613
|
</tr>
|
@@ -5602,7 +5656,10 @@ g_variant_builder_end (<em class="parameter"><code><a class="link" href="glib-GV
|
|
5602
5656
|
in any way after this call
|
5603
5657
|
except for reference counting operations (in the case of a
|
5604
5658
|
heap-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>) or by reinitialising it with
|
5605
|
-
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a> (in the case of stack-allocated)
|
5659
|
+
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a> (in the case of stack-allocated). This
|
5660
|
+
means that for the stack-allocated builders there is no need to
|
5661
|
+
call <a class="link" href="glib-GVariant.html#g-variant-builder-clear" title="g_variant_builder_clear ()"><code class="function">g_variant_builder_clear()</code></a> after the call to
|
5662
|
+
<a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()"><code class="function">g_variant_builder_end()</code></a>.</p>
|
5606
5663
|
<p>It is an error to call this function in any way that would create an
|
5607
5664
|
inconsistent value to be constructed (ie: insufficient number of
|
5608
5665
|
items added to a container with a specific number of children
|
@@ -6340,7 +6397,7 @@ the GVariant varargs documentation.</p>
|
|
6340
6397
|
<tbody>
|
6341
6398
|
<tr>
|
6342
6399
|
<td class="listing_lines" align="right"><pre>1</pre></td>
|
6343
|
-
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-GVariant.html#g-variant-new-parsed">g_variant_new_parsed</a></span> <span class="gtkdoc opt">(</span><span class="string">"[(
|
6400
|
+
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-GVariant.html#g-variant-new-parsed">g_variant_new_parsed</a></span> <span class="gtkdoc opt">(</span><span class="string">"[('one', 1), ('two', %i), (%s, 3)]"</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="string">"three"</span><span class="gtkdoc opt">);</span></pre></td>
|
6344
6401
|
</tr>
|
6345
6402
|
</tbody>
|
6346
6403
|
</table>
|
@@ -6355,7 +6412,7 @@ result of</p>
|
|
6355
6412
|
<tbody>
|
6356
6413
|
<tr>
|
6357
6414
|
<td class="listing_lines" align="right"><pre>1</pre></td>
|
6358
|
-
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[(</span><span class="string"
|
6415
|
+
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[(</span><span class="string">'one'</span><span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">), (</span><span class="string">'two'</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">), (</span><span class="string">'three'</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">)]</span></pre></td>
|
6359
6416
|
</tr>
|
6360
6417
|
</tbody>
|
6361
6418
|
</table>
|
@@ -6418,7 +6475,7 @@ monospace media where newlines are treated in the usual way.</p>
|
|
6418
6475
|
2
|
6419
6476
|
3</pre></td>
|
6420
6477
|
<td class="listing_code"><pre class="programlisting">unterminated string constant<span class="gtkdoc opt">:</span>
|
6421
|
-
<span class="gtkdoc opt">(</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span> <span class="string"
|
6478
|
+
<span class="gtkdoc opt">(</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span> <span class="string">'abc</span>
|
6422
6479
|
<span class="string"> ^^^^</span></pre></td>
|
6423
6480
|
</tr>
|
6424
6481
|
</tbody>
|
@@ -6435,7 +6492,7 @@ monospace media where newlines are treated in the usual way.</p>
|
|
6435
6492
|
2
|
6436
6493
|
3</pre></td>
|
6437
6494
|
<td class="listing_code"><pre class="programlisting">unable to find a common type<span class="gtkdoc opt">:</span>
|
6438
|
-
<span class="gtkdoc opt">[</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span> <span class="string"
|
6495
|
+
<span class="gtkdoc opt">[</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span> <span class="string">'str'</span><span class="gtkdoc opt">]</span>
|
6439
6496
|
<span class="gtkdoc opt">^ ^^^^^</span></pre></td>
|
6440
6497
|
</tr>
|
6441
6498
|
</tbody>
|
@@ -450,10 +450,10 @@ type".</p>
|
|
450
450
|
<p>This is similar to how instances of abstract classes may not
|
451
451
|
directly exist in other type systems, but instances of their
|
452
452
|
non-abstract subtypes may. For example, in GTK, no object that has
|
453
|
-
the type of <span class="type">GtkBin</span> can exist (since <span class="type">GtkBin</span> is an abstract class),
|
454
|
-
but a <span class="type">GtkWindow</span> can certainly be instantiated, and you would say
|
455
|
-
that the <span class="type">GtkWindow</span> is a <span class="type">GtkBin</span> (since <span class="type">GtkWindow</span> is a subclass of
|
456
|
-
<span class="type">GtkBin</span>).</p>
|
453
|
+
the type of <a href="http://developer.gnome.org/gtk4/GtkBin.html#GtkBin-struct"><span class="type">GtkBin</span></a> can exist (since <a href="http://developer.gnome.org/gtk4/GtkBin.html#GtkBin-struct"><span class="type">GtkBin</span></a> is an abstract class),
|
454
|
+
but a <a href="http://developer.gnome.org/gtk4/GtkWindow.html#GtkWindow-struct"><span class="type">GtkWindow</span></a> can certainly be instantiated, and you would say
|
455
|
+
that the <a href="http://developer.gnome.org/gtk4/GtkWindow.html#GtkWindow-struct"><span class="type">GtkWindow</span></a> is a <a href="http://developer.gnome.org/gtk4/GtkBin.html#GtkBin-struct"><span class="type">GtkBin</span></a> (since <a href="http://developer.gnome.org/gtk4/GtkWindow.html#GtkWindow-struct"><span class="type">GtkWindow</span></a> is a subclass of
|
456
|
+
<a href="http://developer.gnome.org/gtk4/GtkBin.html#GtkBin-struct"><span class="type">GtkBin</span></a>).</p>
|
457
457
|
<div class="refsect3">
|
458
458
|
<a name="id-1.6.18.6.9"></a><h4>GVariant Type Strings</h4>
|
459
459
|
<p>A GVariant type string can be any of the following:</p>
|
@@ -333,7 +333,7 @@ at runtime.</p>
|
|
333
333
|
<span class="gtkdoc kwb">const char</span> <span class="gtkdoc opt">*</span>string<span class="gtkdoc opt">;</span>
|
334
334
|
<span class="gtkdoc opt">...</span>
|
335
335
|
string
|
336
|
-
<span class="gtkdoc opt">=</span> index <span class="gtkdoc opt">&
|
336
|
+
<span class="gtkdoc opt">=</span> index <span class="gtkdoc opt">&</span>gt<span class="gtkdoc opt">;</span> <span class="number">1</span> ? <span class="function">_</span><span class="gtkdoc opt">(</span><span class="string">"a default message"</span><span class="gtkdoc opt">) :</span> <span class="function">gettext</span> <span class="gtkdoc opt">(</span>messages<span class="gtkdoc opt">[</span>index<span class="gtkdoc opt">]);</span>
|
337
337
|
|
338
338
|
<span class="function">fputs</span> <span class="gtkdoc opt">(</span>string<span class="gtkdoc opt">);</span>
|
339
339
|
<span class="gtkdoc opt">...</span>
|
@@ -676,8 +676,8 @@ access the channel after it is closed).</p>
|
|
676
676
|
<tbody>
|
677
677
|
<tr>
|
678
678
|
<td class="parameter_name"><p>filename</p></td>
|
679
|
-
<td class="parameter_description"><p>A string containing the name of a file</p></td>
|
680
|
-
<td class="parameter_annotations">
|
679
|
+
<td class="parameter_description"><p> A string containing the name of a file. </p></td>
|
680
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
|
681
681
|
</tr>
|
682
682
|
<tr>
|
683
683
|
<td class="parameter_name"><p>mode</p></td>
|
@@ -100,6 +100,14 @@
|
|
100
100
|
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
101
101
|
</td>
|
102
102
|
<td class="function_name">
|
103
|
+
<a class="link" href="glib-Key-value-file-parser.html#g-key-file-load-from-bytes" title="g_key_file_load_from_bytes ()">g_key_file_load_from_bytes</a> <span class="c_punctuation">()</span>
|
104
|
+
</td>
|
105
|
+
</tr>
|
106
|
+
<tr>
|
107
|
+
<td class="function_type">
|
108
|
+
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
109
|
+
</td>
|
110
|
+
<td class="function_name">
|
103
111
|
<a class="link" href="glib-Key-value-file-parser.html#g-key-file-load-from-data-dirs" title="g_key_file_load_from_data_dirs ()">g_key_file_load_from_data_dirs</a> <span class="c_punctuation">()</span>
|
104
112
|
</td>
|
105
113
|
</tr>
|
@@ -888,6 +896,55 @@ in bytes (or (gsize)-1 if data is nul-terminated)</p></td>
|
|
888
896
|
</div>
|
889
897
|
<hr>
|
890
898
|
<div class="refsect2">
|
899
|
+
<a name="g-key-file-load-from-bytes"></a><h3>g_key_file_load_from_bytes ()</h3>
|
900
|
+
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
901
|
+
g_key_file_load_from_bytes (<em class="parameter"><code><a class="link" href="glib-Key-value-file-parser.html#GKeyFile" title="GKeyFile"><span class="type">GKeyFile</span></a> *key_file</code></em>,
|
902
|
+
<em class="parameter"><code><a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> *bytes</code></em>,
|
903
|
+
<em class="parameter"><code><a class="link" href="glib-Key-value-file-parser.html#GKeyFileFlags" title="enum GKeyFileFlags"><span class="type">GKeyFileFlags</span></a> flags</code></em>,
|
904
|
+
<em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
905
|
+
<p>Loads a key file from the data in <em class="parameter"><code>bytes</code></em>
|
906
|
+
into an empty <a class="link" href="glib-Key-value-file-parser.html#GKeyFile" title="GKeyFile"><span class="type">GKeyFile</span></a> structure.
|
907
|
+
If the object cannot be created then <code class="literal">error</code> is set to a <a class="link" href="glib-Key-value-file-parser.html#GKeyFileError" title="enum GKeyFileError"><span class="type">GKeyFileError</span></a>.</p>
|
908
|
+
<div class="refsect3">
|
909
|
+
<a name="g-key-file-load-from-bytes.parameters"></a><h4>Parameters</h4>
|
910
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
911
|
+
<colgroup>
|
912
|
+
<col width="150px" class="parameters_name">
|
913
|
+
<col class="parameters_description">
|
914
|
+
<col width="200px" class="parameters_annotations">
|
915
|
+
</colgroup>
|
916
|
+
<tbody>
|
917
|
+
<tr>
|
918
|
+
<td class="parameter_name"><p>key_file</p></td>
|
919
|
+
<td class="parameter_description"><p>an empty <a class="link" href="glib-Key-value-file-parser.html#GKeyFile" title="GKeyFile"><span class="type">GKeyFile</span></a> struct</p></td>
|
920
|
+
<td class="parameter_annotations"> </td>
|
921
|
+
</tr>
|
922
|
+
<tr>
|
923
|
+
<td class="parameter_name"><p>bytes</p></td>
|
924
|
+
<td class="parameter_description"><p>a <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a></p></td>
|
925
|
+
<td class="parameter_annotations"> </td>
|
926
|
+
</tr>
|
927
|
+
<tr>
|
928
|
+
<td class="parameter_name"><p>flags</p></td>
|
929
|
+
<td class="parameter_description"><p>flags from <a class="link" href="glib-Key-value-file-parser.html#GKeyFileFlags" title="enum GKeyFileFlags"><span class="type">GKeyFileFlags</span></a></p></td>
|
930
|
+
<td class="parameter_annotations"> </td>
|
931
|
+
</tr>
|
932
|
+
<tr>
|
933
|
+
<td class="parameter_name"><p>error</p></td>
|
934
|
+
<td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
|
935
|
+
<td class="parameter_annotations"> </td>
|
936
|
+
</tr>
|
937
|
+
</tbody>
|
938
|
+
</table></div>
|
939
|
+
</div>
|
940
|
+
<div class="refsect3">
|
941
|
+
<a name="g-key-file-load-from-bytes.returns"></a><h4>Returns</h4>
|
942
|
+
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a key file could be loaded, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
|
943
|
+
</div>
|
944
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
945
|
+
</div>
|
946
|
+
<hr>
|
947
|
+
<div class="refsect2">
|
891
948
|
<a name="g-key-file-load-from-data-dirs"></a><h3>g_key_file_load_from_data_dirs ()</h3>
|
892
949
|
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
893
950
|
g_key_file_load_from_data_dirs (<em class="parameter"><code><a class="link" href="glib-Key-value-file-parser.html#GKeyFile" title="GKeyFile"><span class="type">GKeyFile</span></a> *key_file</code></em>,
|
@@ -214,8 +214,8 @@ be accessed either with a string or with a <a class="link" href="glib-Quarks.htm
|
|
214
214
|
the string.</p>
|
215
215
|
<p>The <a class="link" href="glib-Quarks.html#GQuark" title="GQuark"><span class="type">GQuark</span></a> methods are quicker, since the strings have to be
|
216
216
|
converted to <a href="glib-Quarks.html#GQuark"><span class="type">GQuarks</span></a> anyway.</p>
|
217
|
-
<p>Data lists are used for associating arbitrary data with <a href="
|
218
|
-
using <a href="
|
217
|
+
<p>Data lists are used for associating arbitrary data with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObjects</span></a>,
|
218
|
+
using <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set-data"><code class="function">g_object_set_data()</code></a> and related functions.</p>
|
219
219
|
<p>To create a datalist, use <a class="link" href="glib-Keyed-Data-Lists.html#g-datalist-init" title="g_datalist_init ()"><code class="function">g_datalist_init()</code></a>.</p>
|
220
220
|
<p>To add data elements to a datalist use <a class="link" href="glib-Keyed-Data-Lists.html#g-datalist-id-set-data" title="g_datalist_id_set_data()"><code class="function">g_datalist_id_set_data()</code></a>,
|
221
221
|
<a class="link" href="glib-Keyed-Data-Lists.html#g-datalist-id-set-data-full" title="g_datalist_id_set_data_full ()"><code class="function">g_datalist_id_set_data_full()</code></a>, <a class="link" href="glib-Keyed-Data-Lists.html#g-datalist-set-data" title="g_datalist_set_data()"><code class="function">g_datalist_set_data()</code></a> and
|
@@ -877,7 +877,7 @@ g_datalist_set_flags (<em class="parameter"><code><a class="link" href="glib-Key
|
|
877
877
|
to keep a small number of boolean flags in an object with
|
878
878
|
a data list without using any additional space. It is
|
879
879
|
not generally useful except in circumstances where space
|
880
|
-
is very tight. (It is used in the base <a href="
|
880
|
+
is very tight. (It is used in the base <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> type, for
|
881
881
|
example.)</p>
|
882
882
|
<div class="refsect3">
|
883
883
|
<a name="g-datalist-set-flags.parameters"></a><h4>Parameters</h4>
|
@@ -1084,7 +1084,7 @@ the following example (which only works on GCC and clang):</p>
|
|
1084
1084
|
<td class="listing_code"><pre class="programlisting">GObject <span class="gtkdoc opt">*</span>
|
1085
1085
|
<span class="function">create_object</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">void</span><span class="gtkdoc opt">)</span>
|
1086
1086
|
<span class="gtkdoc opt">{</span>
|
1087
|
-
<span class="function"><a href="glib-Miscellaneous-Macros.html#g-autoptr">g_autoptr</a></span><span class="gtkdoc opt">(</span>GObject<span class="gtkdoc opt">)</span> obj <span class="gtkdoc opt">=</span> <span class="function"><a href="
|
1087
|
+
<span class="function"><a href="glib-Miscellaneous-Macros.html#g-autoptr">g_autoptr</a></span><span class="gtkdoc opt">(</span>GObject<span class="gtkdoc opt">)</span> obj <span class="gtkdoc opt">=</span> <span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-new">g_object_new</a></span> <span class="gtkdoc opt">(</span>G_TYPE_OBJECT<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
|
1088
1088
|
|
1089
1089
|
<span class="keyword">if</span> <span class="gtkdoc opt">(</span>early_error_case<span class="gtkdoc opt">)</span>
|
1090
1090
|
<span class="keyword">return</span> NULL<span class="gtkdoc opt">;</span>
|
@@ -1119,7 +1119,7 @@ particularly useful for dealing with optional out parameters:</p>
|
|
1119
1119
|
<td class="listing_code"><pre class="programlisting">gboolean
|
1120
1120
|
<span class="function">get_object</span> <span class="gtkdoc opt">(</span>GObject <span class="gtkdoc opt">**</span>obj_out<span class="gtkdoc opt">)</span>
|
1121
1121
|
<span class="gtkdoc opt">{</span>
|
1122
|
-
<span class="function"><a href="glib-Miscellaneous-Macros.html#g-autoptr">g_autoptr</a></span><span class="gtkdoc opt">(</span>GObject<span class="gtkdoc opt">)</span> obj <span class="gtkdoc opt">=</span> <span class="function"><a href="
|
1122
|
+
<span class="function"><a href="glib-Miscellaneous-Macros.html#g-autoptr">g_autoptr</a></span><span class="gtkdoc opt">(</span>GObject<span class="gtkdoc opt">)</span> obj <span class="gtkdoc opt">=</span> <span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-new">g_object_new</a></span> <span class="gtkdoc opt">(</span>G_TYPE_OBJECT<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
|
1123
1123
|
|
1124
1124
|
<span class="keyword">if</span> <span class="gtkdoc opt">(</span>early_error_case<span class="gtkdoc opt">)</span>
|
1125
1125
|
<span class="keyword">return</span> FALSE<span class="gtkdoc opt">;</span>
|
@@ -2,11 +2,11 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
|
-
<title>Message
|
5
|
+
<title>Message Output and Debugging Functions: GLib Reference Manual</title>
|
6
6
|
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
7
7
|
<link rel="home" href="index.html" title="GLib Reference Manual">
|
8
8
|
<link rel="up" href="glib-core.html" title="GLib Core Application Support">
|
9
|
-
<link rel="prev" href="glib-Warnings-and-Assertions.html" title="
|
9
|
+
<link rel="prev" href="glib-Warnings-and-Assertions.html" title="Warnings and Assertions">
|
10
10
|
<link rel="next" href="glib-utilities.html" title="GLib Utilities">
|
11
11
|
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
|
12
12
|
<link rel="stylesheet" href="style.css" type="text/css">
|
@@ -26,9 +26,8 @@
|
|
26
26
|
<a name="glib-Message-Logging"></a><div class="titlepage"></div>
|
27
27
|
<div class="refnamediv"><table width="100%"><tr>
|
28
28
|
<td valign="top">
|
29
|
-
<h2><span class="refentrytitle"><a name="glib-Message-Logging.top_of_page"></a>Message
|
30
|
-
<p>Message
|
31
|
-
with different levels of importance</p>
|
29
|
+
<h2><span class="refentrytitle"><a name="glib-Message-Logging.top_of_page"></a>Message Output and Debugging Functions</span></h2>
|
30
|
+
<p>Message Output and Debugging Functions — functions to output messages and help debug applications</p>
|
32
31
|
</td>
|
33
32
|
<td class="gallery_image" valign="top" align="right"></td>
|
34
33
|
</tr></table></div>
|
@@ -156,6 +155,98 @@
|
|
156
155
|
<a class="link" href="glib-Message-Logging.html#g-log-set-default-handler" title="g_log_set_default_handler ()">g_log_set_default_handler</a> <span class="c_punctuation">()</span>
|
157
156
|
</td>
|
158
157
|
</tr>
|
158
|
+
<tr>
|
159
|
+
<td class="function_type">
|
160
|
+
<span class="returnvalue">void</span>
|
161
|
+
</td>
|
162
|
+
<td class="function_name">
|
163
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()">g_log_structured</a> <span class="c_punctuation">()</span>
|
164
|
+
</td>
|
165
|
+
</tr>
|
166
|
+
<tr>
|
167
|
+
<td class="function_type">
|
168
|
+
<span class="returnvalue">void</span>
|
169
|
+
</td>
|
170
|
+
<td class="function_name">
|
171
|
+
<a class="link" href="glib-Message-Logging.html#g-log-variant" title="g_log_variant ()">g_log_variant</a> <span class="c_punctuation">()</span>
|
172
|
+
</td>
|
173
|
+
</tr>
|
174
|
+
<tr>
|
175
|
+
<td class="function_type">
|
176
|
+
<span class="returnvalue">void</span>
|
177
|
+
</td>
|
178
|
+
<td class="function_name">
|
179
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()">g_log_structured_array</a> <span class="c_punctuation">()</span>
|
180
|
+
</td>
|
181
|
+
</tr>
|
182
|
+
<tr>
|
183
|
+
<td class="define_keyword">#define</td>
|
184
|
+
<td class="function_name"><a class="link" href="glib-Message-Logging.html#G-DEBUG-HERE:CAPS" title="G_DEBUG_HERE">G_DEBUG_HERE</a></td>
|
185
|
+
</tr>
|
186
|
+
<tr>
|
187
|
+
<td class="function_type">
|
188
|
+
<a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
189
|
+
</td>
|
190
|
+
<td class="function_name">
|
191
|
+
<span class="c_punctuation">(</span><a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()">*GLogWriterFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
|
192
|
+
</td>
|
193
|
+
</tr>
|
194
|
+
<tr>
|
195
|
+
<td class="function_type">
|
196
|
+
<span class="returnvalue">void</span>
|
197
|
+
</td>
|
198
|
+
<td class="function_name">
|
199
|
+
<a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()">g_log_set_writer_func</a> <span class="c_punctuation">()</span>
|
200
|
+
</td>
|
201
|
+
</tr>
|
202
|
+
<tr>
|
203
|
+
<td class="function_type">
|
204
|
+
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
205
|
+
</td>
|
206
|
+
<td class="function_name">
|
207
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-supports-color" title="g_log_writer_supports_color ()">g_log_writer_supports_color</a> <span class="c_punctuation">()</span>
|
208
|
+
</td>
|
209
|
+
</tr>
|
210
|
+
<tr>
|
211
|
+
<td class="function_type">
|
212
|
+
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
213
|
+
</td>
|
214
|
+
<td class="function_name">
|
215
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-is-journald" title="g_log_writer_is_journald ()">g_log_writer_is_journald</a> <span class="c_punctuation">()</span>
|
216
|
+
</td>
|
217
|
+
</tr>
|
218
|
+
<tr>
|
219
|
+
<td class="function_type">
|
220
|
+
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
|
221
|
+
</td>
|
222
|
+
<td class="function_name">
|
223
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-format-fields" title="g_log_writer_format_fields ()">g_log_writer_format_fields</a> <span class="c_punctuation">()</span>
|
224
|
+
</td>
|
225
|
+
</tr>
|
226
|
+
<tr>
|
227
|
+
<td class="function_type">
|
228
|
+
<a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
229
|
+
</td>
|
230
|
+
<td class="function_name">
|
231
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-journald" title="g_log_writer_journald ()">g_log_writer_journald</a> <span class="c_punctuation">()</span>
|
232
|
+
</td>
|
233
|
+
</tr>
|
234
|
+
<tr>
|
235
|
+
<td class="function_type">
|
236
|
+
<a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
237
|
+
</td>
|
238
|
+
<td class="function_name">
|
239
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-standard-streams" title="g_log_writer_standard_streams ()">g_log_writer_standard_streams</a> <span class="c_punctuation">()</span>
|
240
|
+
</td>
|
241
|
+
</tr>
|
242
|
+
<tr>
|
243
|
+
<td class="function_type">
|
244
|
+
<a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
245
|
+
</td>
|
246
|
+
<td class="function_name">
|
247
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-default" title="g_log_writer_default ()">g_log_writer_default</a> <span class="c_punctuation">()</span>
|
248
|
+
</td>
|
249
|
+
</tr>
|
159
250
|
</tbody>
|
160
251
|
</table></div>
|
161
252
|
</div>
|
@@ -183,6 +274,14 @@
|
|
183
274
|
<td class="datatype_keyword">enum</td>
|
184
275
|
<td class="function_name"><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a></td>
|
185
276
|
</tr>
|
277
|
+
<tr>
|
278
|
+
<td class="datatype_keyword">struct</td>
|
279
|
+
<td class="function_name"><a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField">GLogField</a></td>
|
280
|
+
</tr>
|
281
|
+
<tr>
|
282
|
+
<td class="datatype_keyword">enum</td>
|
283
|
+
<td class="function_name"><a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput">GLogWriterOutput</a></td>
|
284
|
+
</tr>
|
186
285
|
</tbody>
|
187
286
|
</table></div>
|
188
287
|
</div>
|
@@ -193,10 +292,132 @@
|
|
193
292
|
</div>
|
194
293
|
<div class="refsect1">
|
195
294
|
<a name="glib-Message-Logging.description"></a><h2>Description</h2>
|
196
|
-
<p>These functions provide support for
|
197
|
-
|
198
|
-
<
|
199
|
-
<a class="link" href="glib-
|
295
|
+
<p>These functions provide support for outputting messages.</p>
|
296
|
+
<p>The g_return family of macros (<a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()"><code class="function">g_return_if_fail()</code></a>,
|
297
|
+
<a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-fail" title="g_return_val_if_fail()"><code class="function">g_return_val_if_fail()</code></a>, <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-reached" title="g_return_if_reached"><code class="function">g_return_if_reached()</code></a>,
|
298
|
+
<a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-reached" title="g_return_val_if_reached()"><code class="function">g_return_val_if_reached()</code></a>) should only be used for programming
|
299
|
+
errors, a typical use case is checking for invalid parameters at
|
300
|
+
the beginning of a public function. They should not be used if
|
301
|
+
you just mean "if (error) return", they should only be used if
|
302
|
+
you mean "if (bug in program) return". The program behavior is
|
303
|
+
generally considered undefined after one of these checks fails.
|
304
|
+
They are not intended for normal control flow, only to give a
|
305
|
+
perhaps-helpful warning before giving up.</p>
|
306
|
+
<p>Structured logging output is supported using <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>. This differs
|
307
|
+
from the traditional <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> API in that log messages are handled as a
|
308
|
+
collection of key–value pairs representing individual pieces of information,
|
309
|
+
rather than as a single string containing all the information in an arbitrary
|
310
|
+
format.</p>
|
311
|
+
<p>The convenience macros <a class="link" href="glib-Message-Logging.html#g-info" title="g_info()"><code class="function">g_info()</code></a>, <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>, <a class="link" href="glib-Message-Logging.html#g-debug" title="g_debug()"><code class="function">g_debug()</code></a>, <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a> and <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a>
|
312
|
+
will use the traditional <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> API unless you define the symbol
|
313
|
+
<code class="literal">G_LOG_USE_STRUCTURED</code> before including <code class="literal">glib.h</code>. But note that even messages
|
314
|
+
logged through the traditional <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> API are ultimatively passed to
|
315
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>, so that all log messages end up in same destination.
|
316
|
+
If <code class="literal">G_LOG_USE_STRUCTURED</code> is defined, <a class="link" href="glib-Testing.html#g-test-expect-message" title="g_test_expect_message ()"><code class="function">g_test_expect_message()</code></a> will become
|
317
|
+
ineffective for the wrapper macros <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a> and friends (see
|
318
|
+
Testing for Messages).</p>
|
319
|
+
<p>The support for structured logging was motivated by the following needs (some
|
320
|
+
of which were supported previously; others weren’t):</p>
|
321
|
+
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
322
|
+
<li class="listitem"><p>Support for multiple logging levels.</p></li>
|
323
|
+
<li class="listitem"><p>Structured log support with the ability to add <code class="literal">MESSAGE_ID</code>s (see
|
324
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>).</p></li>
|
325
|
+
<li class="listitem"><p>Moving the responsibility for filtering log messages from the program to
|
326
|
+
the log viewer — instead of libraries and programs installing log handlers
|
327
|
+
(with <a class="link" href="glib-Message-Logging.html#g-log-set-handler" title="g_log_set_handler ()"><code class="function">g_log_set_handler()</code></a>) which filter messages before output, all log
|
328
|
+
messages are outputted, and the log viewer program (such as <code class="literal">journalctl</code>)
|
329
|
+
must filter them. This is based on the idea that bugs are sometimes hard
|
330
|
+
to reproduce, so it is better to log everything possible and then use
|
331
|
+
tools to analyse the logs than it is to not be able to reproduce a bug to
|
332
|
+
get additional log data. Code which uses logging in performance-critical
|
333
|
+
sections should compile out the <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> calls in
|
334
|
+
release builds, and compile them in in debugging builds.</p></li>
|
335
|
+
<li class="listitem"><p>A single writer function which handles all log messages in a process, from
|
336
|
+
all libraries and program code; rather than multiple log handlers with
|
337
|
+
poorly defined interactions between them. This allows a program to easily
|
338
|
+
change its logging policy by changing the writer function, for example to
|
339
|
+
log to an additional location or to change what logging output fallbacks
|
340
|
+
are used. The log writer functions provided by GLib are exposed publicly
|
341
|
+
so they can be used from programs’ log writers. This allows log writer
|
342
|
+
policy and implementation to be kept separate.</p></li>
|
343
|
+
<li class="listitem"><p>If a library wants to add standard information to all of its log messages
|
344
|
+
(such as library state) or to redact private data (such as passwords or
|
345
|
+
network credentials), it should use a wrapper function around its
|
346
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> calls or implement that in the single log writer
|
347
|
+
function.</p></li>
|
348
|
+
<li class="listitem"><p>If a program wants to pass context data from a <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> call to
|
349
|
+
its log writer function so that, for example, it can use the correct
|
350
|
+
server connection to submit logs to, that user data can be passed as a
|
351
|
+
zero-length <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> to <a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a>.</p></li>
|
352
|
+
<li class="listitem"><p>Color output needed to be supported on the terminal, to make reading
|
353
|
+
through logs easier.</p></li>
|
354
|
+
</ul></div>
|
355
|
+
<div class="refsect3">
|
356
|
+
<a name="id-1.4.12.6.8"></a><h4>Using Structured Logging</h4>
|
357
|
+
<p>To use structured logging (rather than the old-style logging), either use
|
358
|
+
the <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> and <a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a> functions; or define
|
359
|
+
<code class="literal">G_LOG_USE_STRUCTURED</code> before including any GLib header, and use the
|
360
|
+
<a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>, <a class="link" href="glib-Message-Logging.html#g-debug" title="g_debug()"><code class="function">g_debug()</code></a>, <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a> (etc.) macros.</p>
|
361
|
+
<p>You do not need to define <code class="literal">G_LOG_USE_STRUCTURED</code> to use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>,
|
362
|
+
but it is a good idea to avoid confusion.</p>
|
363
|
+
</div>
|
364
|
+
<div class="refsect3">
|
365
|
+
<a name="id-1.4.12.6.9"></a><h4>Log Domains</h4>
|
366
|
+
<p>Log domains may be used to broadly split up the origins of log messages.
|
367
|
+
Typically, there are one or a few log domains per application or library.
|
368
|
+
<a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN:CAPS" title="G_LOG_DOMAIN"><code class="literal">G_LOG_DOMAIN</code></a> should be used to define the default log domain for the current
|
369
|
+
compilation unit — it is typically defined at the top of a source file, or in
|
370
|
+
the preprocessor flags for a group of source files.</p>
|
371
|
+
<p>Log domains must be unique, and it is recommended that they are the
|
372
|
+
application or library name, optionally followed by a hyphen and a sub-domain
|
373
|
+
name. For example, <code class="literal">bloatpad</code> or <code class="literal">bloatpad-io</code>.</p>
|
374
|
+
</div>
|
375
|
+
<div class="refsect3">
|
376
|
+
<a name="id-1.4.12.6.10"></a><h4>Debug Message Output</h4>
|
377
|
+
<p>The default log functions (<a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> for the old-style API and
|
378
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-default" title="g_log_writer_default ()"><code class="function">g_log_writer_default()</code></a> for the structured API) both drop debug and
|
379
|
+
informational messages by default, unless the log domains of those messages
|
380
|
+
are listed in the <code class="literal">G_MESSAGES_DEBUG</code> environment variable (or it is set to
|
381
|
+
<code class="literal">all</code>).</p>
|
382
|
+
<p>It is recommended that custom log writer functions re-use the
|
383
|
+
<code class="literal">G_MESSAGES_DEBUG</code> environment variable, rather than inventing a custom one,
|
384
|
+
so that developers can re-use the same debugging techniques and tools across
|
385
|
+
projects.</p>
|
386
|
+
</div>
|
387
|
+
<div class="refsect3">
|
388
|
+
<a name="id-1.4.12.6.11"></a><h4>Testing for Messages</h4>
|
389
|
+
<p>With the old <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> API, <a class="link" href="glib-Testing.html#g-test-expect-message" title="g_test_expect_message ()"><code class="function">g_test_expect_message()</code></a> and
|
390
|
+
<a class="link" href="glib-Testing.html#g-test-assert-expected-messages" title="g_test_assert_expected_messages"><code class="function">g_test_assert_expected_messages()</code></a> could be used in simple cases to check
|
391
|
+
whether some code under test had emitted a given log message. These
|
392
|
+
functions have been deprecated with the structured logging API, for several
|
393
|
+
reasons:</p>
|
394
|
+
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
395
|
+
<li class="listitem"><p>They relied on an internal queue which was too inflexible for many use
|
396
|
+
cases, where messages might be emitted in several orders, some
|
397
|
+
messages might not be emitted deterministically, or messages might be
|
398
|
+
emitted by unrelated log domains.</p></li>
|
399
|
+
<li class="listitem"><p>They do not support structured log fields.</p></li>
|
400
|
+
<li class="listitem"><p>Examining the log output of code is a bad approach to testing it, and
|
401
|
+
while it might be necessary for legacy code which uses <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>, it should
|
402
|
+
be avoided for new code using <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>.</p></li>
|
403
|
+
</ul></div>
|
404
|
+
<p>They will continue to work as before if <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> is in use (and
|
405
|
+
<code class="literal">G_LOG_USE_STRUCTURED</code> is not defined). They will do nothing if used with the
|
406
|
+
structured logging API.</p>
|
407
|
+
<p>Examining the log output of code is discouraged: libraries should not emit to
|
408
|
+
<code class="literal">stderr</code> during defined behaviour, and hence this should not be tested. If
|
409
|
+
the log emissions of a library during undefined behaviour need to be tested,
|
410
|
+
they should be limited to asserting that the library aborts and prints a
|
411
|
+
suitable error message before aborting. This should be done with
|
412
|
+
<a class="link" href="glib-Testing.html#g-test-trap-assert-stderr" title="g_test_trap_assert_stderr()"><code class="function">g_test_trap_assert_stderr()</code></a>.</p>
|
413
|
+
<p>If it is really necessary to test the structured log messages emitted by a
|
414
|
+
particular piece of code – and the code cannot be restructured to be more
|
415
|
+
suitable to more conventional unit testing – you should write a custom log
|
416
|
+
writer function (see <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>) which appends all log messages
|
417
|
+
to a queue. When you want to check the log messages, examine and clear the
|
418
|
+
queue, ignoring irrelevant log messages (for example, from log domains other
|
419
|
+
than the one under test).</p>
|
420
|
+
</div>
|
200
421
|
</div>
|
201
422
|
<div class="refsect1">
|
202
423
|
<a name="glib-Message-Logging.functions_details"></a><h2>Functions</h2>
|
@@ -214,6 +435,8 @@ new-line character to <em class="parameter"><code>message</code></em>
|
|
214
435
|
custom log handler functions behave similarly, so that logging calls in user
|
215
436
|
code do not need modifying to add a new-line character to the message if the
|
216
437
|
log handler is changed.</p>
|
438
|
+
<p>This is not used if structured logging is enabled; see
|
439
|
+
Using Structured Logging.</p>
|
217
440
|
<div class="refsect3">
|
218
441
|
<a name="GLogFunc.parameters"></a><h4>Parameters</h4>
|
219
442
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -262,6 +485,8 @@ function is called to terminate the program.</p>
|
|
262
485
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
263
486
|
character will automatically be appended to @..., and need not be entered
|
264
487
|
manually.</p>
|
488
|
+
<p>If structured logging is enabled this will
|
489
|
+
output via the structured log writer function (see <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>).</p>
|
265
490
|
<div class="refsect3">
|
266
491
|
<a name="g-log.parameters"></a><h4>Parameters</h4>
|
267
492
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -311,6 +536,8 @@ function is called to terminate the program.</p>
|
|
311
536
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
312
537
|
character will automatically be appended to @..., and need not be entered
|
313
538
|
manually.</p>
|
539
|
+
<p>If structured logging is enabled this will
|
540
|
+
output via the structured log writer function (see <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>).</p>
|
314
541
|
<div class="refsect3">
|
315
542
|
<a name="g-logv.parameters"></a><h4>Parameters</h4>
|
316
543
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -353,6 +580,9 @@ application domain. </p></td>
|
|
353
580
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
354
581
|
character will automatically be appended to @..., and need not be entered
|
355
582
|
manually.</p>
|
583
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
584
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
585
|
+
Using Structured Logging.</p>
|
356
586
|
<div class="refsect3">
|
357
587
|
<a name="g-message.parameters"></a><h4>Parameters</h4>
|
358
588
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -384,6 +614,9 @@ environment variable (see
|
|
384
614
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function,
|
385
615
|
a newline character will automatically be appended to @..., and
|
386
616
|
need not be entered manually.</p>
|
617
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
618
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
619
|
+
Using Structured Logging.</p>
|
387
620
|
<div class="refsect3">
|
388
621
|
<a name="g-warning.parameters"></a><h4>Parameters</h4>
|
389
622
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -417,6 +650,9 @@ setting the <code class="literal">G_DEBUG</code> environment variable (see
|
|
417
650
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
418
651
|
character will automatically be appended to @..., and need not be entered
|
419
652
|
manually.</p>
|
653
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
654
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
655
|
+
Using Structured Logging.</p>
|
420
656
|
<div class="refsect3">
|
421
657
|
<a name="g-critical.parameters"></a><h4>Parameters</h4>
|
422
658
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -450,6 +686,9 @@ an assertion failure.</p>
|
|
450
686
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
451
687
|
character will automatically be appended to @..., and need not be entered
|
452
688
|
manually.</p>
|
689
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
690
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
691
|
+
Using Structured Logging.</p>
|
453
692
|
<div class="refsect3">
|
454
693
|
<a name="g-error.parameters"></a><h4>Parameters</h4>
|
455
694
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -475,8 +714,12 @@ into the format string (as with <code class="function">printf()</code>)</p></td>
|
|
475
714
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
476
715
|
character will automatically be appended to @..., and need not be entered
|
477
716
|
manually.</p>
|
478
|
-
<p>Such messages are suppressed by the <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a>
|
479
|
-
the G_MESSAGES_DEBUG environment variable is
|
717
|
+
<p>Such messages are suppressed by the <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> and
|
718
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-default" title="g_log_writer_default ()"><code class="function">g_log_writer_default()</code></a> unless the <code class="literal">G_MESSAGES_DEBUG</code> environment variable is
|
719
|
+
set appropriately.</p>
|
720
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
721
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
722
|
+
Using Structured Logging.</p>
|
480
723
|
<div class="refsect3">
|
481
724
|
<a name="g-info.parameters"></a><h4>Parameters</h4>
|
482
725
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -503,8 +746,12 @@ into the format string (as with <code class="function">printf()</code>)</p></td>
|
|
503
746
|
<p>If <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> is used as the log handler function, a new-line
|
504
747
|
character will automatically be appended to @..., and need not be entered
|
505
748
|
manually.</p>
|
506
|
-
<p>Such messages are suppressed by the <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a>
|
507
|
-
the G_MESSAGES_DEBUG environment variable is
|
749
|
+
<p>Such messages are suppressed by the <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> and
|
750
|
+
<a class="link" href="glib-Message-Logging.html#g-log-writer-default" title="g_log_writer_default ()"><code class="function">g_log_writer_default()</code></a> unless the <code class="literal">G_MESSAGES_DEBUG</code> environment variable is
|
751
|
+
set appropriately.</p>
|
752
|
+
<p>If structured logging is enabled, this will use <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>;
|
753
|
+
otherwise it will use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>. See
|
754
|
+
Using Structured Logging.</p>
|
508
755
|
<div class="refsect3">
|
509
756
|
<a name="g-debug.parameters"></a><h4>Parameters</h4>
|
510
757
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -539,6 +786,8 @@ bit flags.</p>
|
|
539
786
|
<p>Note that since the <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><span class="type">G_LOG_LEVEL_ERROR</span></a> log level is always fatal, if
|
540
787
|
you want to set a handler for this log level you must combine it with
|
541
788
|
<a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL:CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a>.</p>
|
789
|
+
<p>This has no effect if structured logging is enabled; see
|
790
|
+
Using Structured Logging.</p>
|
542
791
|
<p>Here is an example for adding a log handler for all warning messages
|
543
792
|
in the default domain:</p>
|
544
793
|
<div class="informalexample">
|
@@ -637,6 +886,8 @@ g_log_set_handler_full (<em class="parameter"><code>const <a class="link" href="
|
|
637
886
|
<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> destroy</code></em>);</pre>
|
638
887
|
<p>Like <code class="function">g_log_sets_handler()</code>, but takes a destroy notify for the <em class="parameter"><code>user_data</code></em>
|
639
888
|
.</p>
|
889
|
+
<p>This has no effect if structured logging is enabled; see
|
890
|
+
Using Structured Logging.</p>
|
640
891
|
<p><span class="annotation">[<acronym title="Rename the original symbol's name to SYMBOL."><span class="acronym">rename-to</span></acronym> g_log_set_handler]</span></p>
|
641
892
|
<div class="refsect3">
|
642
893
|
<a name="g-log-set-handler-full.parameters"></a><h4>Parameters</h4>
|
@@ -693,6 +944,8 @@ the log levels with the <a class="link" href="glib-Message-Logging.html#G-LOG-FL
|
|
693
944
|
g_log_remove_handler (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
|
694
945
|
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> handler_id</code></em>);</pre>
|
695
946
|
<p>Removes the log handler.</p>
|
947
|
+
<p>This has no effect if structured logging is enabled; see
|
948
|
+
Using Structured Logging.</p>
|
696
949
|
<div class="refsect3">
|
697
950
|
<a name="g-log-remove-handler.parameters"></a><h4>Parameters</h4>
|
698
951
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -729,6 +982,12 @@ You can only set the levels defined by GLib to be fatal.
|
|
729
982
|
<p>You can also make some message levels fatal at runtime by setting
|
730
983
|
the <code class="literal">G_DEBUG</code> environment variable (see
|
731
984
|
<a class="ulink" href="glib-running.html" target="_top">Running GLib Applications</a>).</p>
|
985
|
+
<p>Libraries should not call this function, as it affects all messages logged
|
986
|
+
by a process, including those from other libraries.</p>
|
987
|
+
<p>Structured log messages (using <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> and
|
988
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a>) are fatal only if the default log writer is used;
|
989
|
+
otherwise it is up to the writer function to determine which log messages
|
990
|
+
are fatal. See Using Structured Logging.</p>
|
732
991
|
<div class="refsect3">
|
733
992
|
<a name="g-log-set-always-fatal.parameters"></a><h4>Parameters</h4>
|
734
993
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -758,6 +1017,11 @@ g_log_set_fatal_mask (<em class="parameter"><code>const <a class="link" href="gl
|
|
758
1017
|
<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> fatal_mask</code></em>);</pre>
|
759
1018
|
<p>Sets the log levels which are fatal in the given domain.
|
760
1019
|
<a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a> is always fatal.</p>
|
1020
|
+
<p>This has no effect on structured log messages (using <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> or
|
1021
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a>). To change the fatal behaviour for specific log
|
1022
|
+
messages, programs must install a custom log writer function using
|
1023
|
+
<a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>. See
|
1024
|
+
Using Structured Logging.</p>
|
761
1025
|
<div class="refsect3">
|
762
1026
|
<a name="g-log-set-fatal-mask.parameters"></a><h4>Parameters</h4>
|
763
1027
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -814,6 +1078,8 @@ these messages are not printed.</p></li>
|
|
814
1078
|
<p>stderr is used for levels <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a>, <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-CRITICAL:CAPS"><code class="literal">G_LOG_LEVEL_CRITICAL</code></a>,
|
815
1079
|
<a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-WARNING:CAPS"><code class="literal">G_LOG_LEVEL_WARNING</code></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-MESSAGE:CAPS"><code class="literal">G_LOG_LEVEL_MESSAGE</code></a>. stdout is used for
|
816
1080
|
the rest.</p>
|
1081
|
+
<p>This has no effect if structured logging is enabled; see
|
1082
|
+
Using Structured Logging.</p>
|
817
1083
|
<div class="refsect3">
|
818
1084
|
<a name="g-log-default-handler.parameters"></a><h4>Parameters</h4>
|
819
1085
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -858,6 +1124,8 @@ g_log_set_default_handler (<em class="parameter"><code><a class="link" href="gli
|
|
858
1124
|
log handler has been set for the particular log domain
|
859
1125
|
and log level combination. By default, GLib uses
|
860
1126
|
<a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> as default log handler.</p>
|
1127
|
+
<p>This has no effect if structured logging is enabled; see
|
1128
|
+
Using Structured Logging.</p>
|
861
1129
|
<div class="refsect3">
|
862
1130
|
<a name="g-log-set-default-handler.parameters"></a><h4>Parameters</h4>
|
863
1131
|
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
@@ -886,6 +1154,650 @@ and log level combination. By default, GLib uses
|
|
886
1154
|
</div>
|
887
1155
|
<p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
|
888
1156
|
</div>
|
1157
|
+
<hr>
|
1158
|
+
<div class="refsect2">
|
1159
|
+
<a name="g-log-structured"></a><h3>g_log_structured ()</h3>
|
1160
|
+
<pre class="programlisting"><span class="returnvalue">void</span>
|
1161
|
+
g_log_structured (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
|
1162
|
+
<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1163
|
+
<em class="parameter"><code>...</code></em>);</pre>
|
1164
|
+
<p>Log a message with structured data. The message will be passed through to
|
1165
|
+
the log writer set by the application using <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>. If the
|
1166
|
+
message is fatal (i.e. its log level is <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a>), the program will
|
1167
|
+
be aborted at the end of this function.</p>
|
1168
|
+
<p>The structured data is provided as key–value pairs, where keys are UTF-8
|
1169
|
+
strings, and values are arbitrary pointers — typically pointing to UTF-8
|
1170
|
+
strings, but that is not a requirement. To pass binary (non-nul-terminated)
|
1171
|
+
structured data, use <a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a>. The keys for structured data
|
1172
|
+
should follow the <a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html" target="_top">systemd journal
|
1173
|
+
fields</a>
|
1174
|
+
specification. It is suggested that custom keys are namespaced according to
|
1175
|
+
the code which sets them. For example, custom keys from GLib all have a
|
1176
|
+
<code class="literal">GLIB_</code> prefix.</p>
|
1177
|
+
<p>The <em class="parameter"><code>log_domain</code></em>
|
1178
|
+
will be converted into a <code class="literal">GLIB_DOMAIN</code> field. <em class="parameter"><code>log_level</code></em>
|
1179
|
+
will
|
1180
|
+
be converted into a
|
1181
|
+
<a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#PRIORITY=" target="_top"><code class="literal">PRIORITY</code></a>
|
1182
|
+
field. The format string will have its placeholders substituted for the provided
|
1183
|
+
values and be converted into a
|
1184
|
+
<a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE=" target="_top"><code class="literal">MESSAGE</code></a>
|
1185
|
+
field.</p>
|
1186
|
+
<p>Other fields you may commonly want to pass into this function:</p>
|
1187
|
+
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
1188
|
+
<li class="listitem"><p><a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE_ID=" target="_top"><code class="literal">MESSAGE_ID</code></a></p></li>
|
1189
|
+
<li class="listitem"><p><a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_FILE=" target="_top"><code class="literal">CODE_FILE</code></a></p></li>
|
1190
|
+
<li class="listitem"><p><a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_LINE=" target="_top"><code class="literal">CODE_LINE</code></a></p></li>
|
1191
|
+
<li class="listitem"><p><a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#CODE_FUNC=" target="_top"><code class="literal">CODE_FUNC</code></a></p></li>
|
1192
|
+
<li class="listitem"><p><a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#ERRNO=" target="_top"><code class="literal">ERRNO</code></a></p></li>
|
1193
|
+
</ul></div>
|
1194
|
+
<p>Note that <code class="literal">CODE_FILE</code>, <code class="literal">CODE_LINE</code> and <code class="literal">CODE_FUNC</code> are automatically set by
|
1195
|
+
the logging macros, <a class="link" href="glib-Message-Logging.html#G-DEBUG-HERE:CAPS" title="G_DEBUG_HERE"><code class="function">G_DEBUG_HERE()</code></a>, <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>, <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a>, <a class="link" href="glib-Message-Logging.html#g-critical" title="g_critical()"><code class="function">g_critical()</code></a>,
|
1196
|
+
<a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a>, etc, if the symbols <code class="literal">G_LOG_USE_STRUCTURED</code> is defined before including
|
1197
|
+
glib.h.</p>
|
1198
|
+
<p>For example:</p>
|
1199
|
+
<div class="informalexample">
|
1200
|
+
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
1201
|
+
<tbody>
|
1202
|
+
<tr>
|
1203
|
+
<td class="listing_lines" align="right"><pre>1
|
1204
|
+
2
|
1205
|
+
3
|
1206
|
+
4
|
1207
|
+
5</pre></td>
|
1208
|
+
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-Message-Logging.html#g-log-structured">g_log_structured</a></span> <span class="gtkdoc opt">(</span>G_LOG_DOMAIN<span class="gtkdoc opt">,</span> G_LOG_LEVEL_DEBUG<span class="gtkdoc opt">,</span>
|
1209
|
+
<span class="string">"MESSAGE_ID"</span><span class="gtkdoc opt">,</span> <span class="string">"06d4df59e6c24647bfe69d2c27ef0b4e"</span><span class="gtkdoc opt">,</span>
|
1210
|
+
<span class="string">"MY_APPLICATION_CUSTOM_FIELD"</span><span class="gtkdoc opt">,</span> <span class="string">"some debug string"</span><span class="gtkdoc opt">,</span>
|
1211
|
+
<span class="string">"MESSAGE"</span><span class="gtkdoc opt">,</span> <span class="string">"This is a debug message about pointer %p and integer %u."</span><span class="gtkdoc opt">,</span>
|
1212
|
+
some_pointer<span class="gtkdoc opt">,</span> some_integer<span class="gtkdoc opt">);</span></pre></td>
|
1213
|
+
</tr>
|
1214
|
+
</tbody>
|
1215
|
+
</table>
|
1216
|
+
</div>
|
1217
|
+
|
1218
|
+
<p></p>
|
1219
|
+
<p>Note that each <code class="literal">MESSAGE_ID</code> must be <a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE_ID=" target="_top">uniquely and randomly
|
1220
|
+
generated</a>.
|
1221
|
+
If adding a <code class="literal">MESSAGE_ID</code>, consider shipping a <a class="ulink" href="https://www.freedesktop.org/wiki/Software/systemd/catalog/" target="_top">message
|
1222
|
+
catalog</a> with
|
1223
|
+
your software.</p>
|
1224
|
+
<p>To pass a user data pointer to the log writer function which is specific to
|
1225
|
+
this logging call, you must use <a class="link" href="glib-Message-Logging.html#g-log-structured-array" title="g_log_structured_array ()"><code class="function">g_log_structured_array()</code></a> and pass the pointer
|
1226
|
+
as a field with <a class="link" href="glib-Message-Logging.html#GLogField.length"><span class="type">GLogField.length</span></a> set to zero, otherwise it will be
|
1227
|
+
interpreted as a string.</p>
|
1228
|
+
<p>For example:</p>
|
1229
|
+
<div class="informalexample">
|
1230
|
+
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
1231
|
+
<tbody>
|
1232
|
+
<tr>
|
1233
|
+
<td class="listing_lines" align="right"><pre>1
|
1234
|
+
2
|
1235
|
+
3
|
1236
|
+
4
|
1237
|
+
5
|
1238
|
+
6
|
1239
|
+
7</pre></td>
|
1240
|
+
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">const</span> GLogField fields<span class="gtkdoc opt">[] = {</span>
|
1241
|
+
<span class="gtkdoc opt">{</span> <span class="string">"MESSAGE"</span><span class="gtkdoc opt">,</span> <span class="string">"This is a debug message."</span><span class="gtkdoc opt">, -</span><span class="number">1</span> <span class="gtkdoc opt">},</span>
|
1242
|
+
<span class="gtkdoc opt">{</span> <span class="string">"MESSAGE_ID"</span><span class="gtkdoc opt">,</span> <span class="string">"fcfb2e1e65c3494386b74878f1abf893"</span><span class="gtkdoc opt">, -</span><span class="number">1</span> <span class="gtkdoc opt">},</span>
|
1243
|
+
<span class="gtkdoc opt">{</span> <span class="string">"MY_APPLICATION_CUSTOM_FIELD"</span><span class="gtkdoc opt">,</span> <span class="string">"some debug string"</span><span class="gtkdoc opt">, -</span><span class="number">1</span> <span class="gtkdoc opt">},</span>
|
1244
|
+
<span class="gtkdoc opt">{</span> <span class="string">"MY_APPLICATION_STATE"</span><span class="gtkdoc opt">,</span> state_object<span class="gtkdoc opt">,</span> <span class="number">0</span> <span class="gtkdoc opt">},</span>
|
1245
|
+
<span class="gtkdoc opt">};</span>
|
1246
|
+
<span class="function"><a href="glib-Message-Logging.html#g-log-structured-array">g_log_structured_array</a></span> <span class="gtkdoc opt">(</span>G_LOG_LEVEL_DEBUG<span class="gtkdoc opt">,</span> fields<span class="gtkdoc opt">,</span> <span class="function"><a href="glib-Standard-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a></span> <span class="gtkdoc opt">(</span>fields<span class="gtkdoc opt">));</span></pre></td>
|
1247
|
+
</tr>
|
1248
|
+
</tbody>
|
1249
|
+
</table>
|
1250
|
+
</div>
|
1251
|
+
|
1252
|
+
<p></p>
|
1253
|
+
<p>Note also that, even if no other structured fields are specified, there
|
1254
|
+
must always be a "MESSAGE" key before the format string. The "MESSAGE"-format
|
1255
|
+
pair has to be the last of the key-value pairs, and "MESSAGE" is the only
|
1256
|
+
field for which <code class="function">printf()</code>-style formatting is supported.</p>
|
1257
|
+
<p>The default writer function for <code class="literal">stdout</code> and <code class="literal">stderr</code> will automatically
|
1258
|
+
append a new-line character after the message, so you should not add one
|
1259
|
+
manually to the format string.</p>
|
1260
|
+
<div class="refsect3">
|
1261
|
+
<a name="g-log-structured.parameters"></a><h4>Parameters</h4>
|
1262
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1263
|
+
<colgroup>
|
1264
|
+
<col width="150px" class="parameters_name">
|
1265
|
+
<col class="parameters_description">
|
1266
|
+
<col width="200px" class="parameters_annotations">
|
1267
|
+
</colgroup>
|
1268
|
+
<tbody>
|
1269
|
+
<tr>
|
1270
|
+
<td class="parameter_name"><p>log_domain</p></td>
|
1271
|
+
<td class="parameter_description"><p>log domain, usually <a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN:CAPS" title="G_LOG_DOMAIN"><code class="literal">G_LOG_DOMAIN</code></a></p></td>
|
1272
|
+
<td class="parameter_annotations"> </td>
|
1273
|
+
</tr>
|
1274
|
+
<tr>
|
1275
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1276
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1277
|
+
level</p></td>
|
1278
|
+
<td class="parameter_annotations"> </td>
|
1279
|
+
</tr>
|
1280
|
+
<tr>
|
1281
|
+
<td class="parameter_name"><p>...</p></td>
|
1282
|
+
<td class="parameter_description"><p>key-value pairs of structured data to add to the log entry, followed
|
1283
|
+
by the key "MESSAGE", followed by a <code class="function">printf()</code>-style message format,
|
1284
|
+
followed by parameters to insert in the format string</p></td>
|
1285
|
+
<td class="parameter_annotations"> </td>
|
1286
|
+
</tr>
|
1287
|
+
</tbody>
|
1288
|
+
</table></div>
|
1289
|
+
</div>
|
1290
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1291
|
+
</div>
|
1292
|
+
<hr>
|
1293
|
+
<div class="refsect2">
|
1294
|
+
<a name="g-log-variant"></a><h3>g_log_variant ()</h3>
|
1295
|
+
<pre class="programlisting"><span class="returnvalue">void</span>
|
1296
|
+
g_log_variant (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
|
1297
|
+
<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1298
|
+
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *fields</code></em>);</pre>
|
1299
|
+
<p>Log a message with structured data, accepting the data within a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This
|
1300
|
+
version is especially useful for use in other languages, via introspection.</p>
|
1301
|
+
<p>The only mandatory item in the <em class="parameter"><code>fields</code></em>
|
1302
|
+
dictionary is the "MESSAGE" which must
|
1303
|
+
contain the text shown to the user.</p>
|
1304
|
+
<p>The values in the <em class="parameter"><code>fields</code></em>
|
1305
|
+
dictionary are likely to be of type String
|
1306
|
+
(<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-STRING:CAPS" title="G_VARIANT_TYPE_STRING"><span class="type">G_VARIANT_TYPE_STRING</span></a>). Array of bytes (<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-BYTESTRING:CAPS" title="G_VARIANT_TYPE_BYTESTRING"><span class="type">G_VARIANT_TYPE_BYTESTRING</span></a>) is also
|
1307
|
+
supported. In this case the message is handled as binary and will be forwarded
|
1308
|
+
to the log writer as such. The size of the array should not be higher than
|
1309
|
+
<a class="link" href="glib-Basic-Types.html#G-MAXSSIZE:CAPS" title="G_MAXSSIZE"><code class="literal">G_MAXSSIZE</code></a>. Otherwise it will be truncated to this size. For other types
|
1310
|
+
<a class="link" href="glib-GVariant.html#g-variant-print" title="g_variant_print ()"><code class="function">g_variant_print()</code></a> will be used to convert the value into a string.</p>
|
1311
|
+
<p>For more details on its usage and about the parameters, see <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>.</p>
|
1312
|
+
<div class="refsect3">
|
1313
|
+
<a name="g-log-variant.parameters"></a><h4>Parameters</h4>
|
1314
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1315
|
+
<colgroup>
|
1316
|
+
<col width="150px" class="parameters_name">
|
1317
|
+
<col class="parameters_description">
|
1318
|
+
<col width="200px" class="parameters_annotations">
|
1319
|
+
</colgroup>
|
1320
|
+
<tbody>
|
1321
|
+
<tr>
|
1322
|
+
<td class="parameter_name"><p>log_domain</p></td>
|
1323
|
+
<td class="parameter_description"><p> log domain, usually <a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN:CAPS" title="G_LOG_DOMAIN"><code class="literal">G_LOG_DOMAIN</code></a>. </p></td>
|
1324
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
|
1325
|
+
</tr>
|
1326
|
+
<tr>
|
1327
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1328
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1329
|
+
level</p></td>
|
1330
|
+
<td class="parameter_annotations"> </td>
|
1331
|
+
</tr>
|
1332
|
+
<tr>
|
1333
|
+
<td class="parameter_name"><p>fields</p></td>
|
1334
|
+
<td class="parameter_description"><p>a dictionary (<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> of the type <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-VARDICT:CAPS" title="G_VARIANT_TYPE_VARDICT"><code class="literal">G_VARIANT_TYPE_VARDICT</code></a>)
|
1335
|
+
containing the key-value pairs of message data.</p></td>
|
1336
|
+
<td class="parameter_annotations"> </td>
|
1337
|
+
</tr>
|
1338
|
+
</tbody>
|
1339
|
+
</table></div>
|
1340
|
+
</div>
|
1341
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1342
|
+
</div>
|
1343
|
+
<hr>
|
1344
|
+
<div class="refsect2">
|
1345
|
+
<a name="g-log-structured-array"></a><h3>g_log_structured_array ()</h3>
|
1346
|
+
<pre class="programlisting"><span class="returnvalue">void</span>
|
1347
|
+
g_log_structured_array (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1348
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1349
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>);</pre>
|
1350
|
+
<p>Log a message with structured data. The message will be passed through to the
|
1351
|
+
log writer set by the application using <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>. If the
|
1352
|
+
message is fatal (i.e. its log level is <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a>), the program will
|
1353
|
+
be aborted at the end of this function.</p>
|
1354
|
+
<p>See <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> for more documentation.</p>
|
1355
|
+
<p>This assumes that <em class="parameter"><code>log_level</code></em>
|
1356
|
+
is already present in <em class="parameter"><code>fields</code></em>
|
1357
|
+
(typically as the
|
1358
|
+
<code class="literal">PRIORITY</code> field).</p>
|
1359
|
+
<div class="refsect3">
|
1360
|
+
<a name="g-log-structured-array.parameters"></a><h4>Parameters</h4>
|
1361
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1362
|
+
<colgroup>
|
1363
|
+
<col width="150px" class="parameters_name">
|
1364
|
+
<col class="parameters_description">
|
1365
|
+
<col width="200px" class="parameters_annotations">
|
1366
|
+
</colgroup>
|
1367
|
+
<tbody>
|
1368
|
+
<tr>
|
1369
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1370
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1371
|
+
level</p></td>
|
1372
|
+
<td class="parameter_annotations"> </td>
|
1373
|
+
</tr>
|
1374
|
+
<tr>
|
1375
|
+
<td class="parameter_name"><p>fields</p></td>
|
1376
|
+
<td class="parameter_description"><p> key–value pairs of structured data to add
|
1377
|
+
to the log message. </p></td>
|
1378
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1379
|
+
</tr>
|
1380
|
+
<tr>
|
1381
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1382
|
+
<td class="parameter_description"><p>number of elements in the <em class="parameter"><code>fields</code></em>
|
1383
|
+
array</p></td>
|
1384
|
+
<td class="parameter_annotations"> </td>
|
1385
|
+
</tr>
|
1386
|
+
</tbody>
|
1387
|
+
</table></div>
|
1388
|
+
</div>
|
1389
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1390
|
+
</div>
|
1391
|
+
<hr>
|
1392
|
+
<div class="refsect2">
|
1393
|
+
<a name="G-DEBUG-HERE:CAPS"></a><h3>G_DEBUG_HERE</h3>
|
1394
|
+
<pre class="programlisting">#define G_DEBUG_HERE()</pre>
|
1395
|
+
<p>A convenience form of <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>, recommended to be added to
|
1396
|
+
functions when debugging. It prints the current monotonic time and the code
|
1397
|
+
location using <a class="link" href="glib-Miscellaneous-Macros.html#G-STRLOC:CAPS" title="G_STRLOC"><code class="literal">G_STRLOC</code></a>.</p>
|
1398
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1399
|
+
</div>
|
1400
|
+
<hr>
|
1401
|
+
<div class="refsect2">
|
1402
|
+
<a name="GLogWriterFunc"></a><h3>GLogWriterFunc ()</h3>
|
1403
|
+
<pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
1404
|
+
<span class="c_punctuation">(</span>*GLogWriterFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1405
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1406
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>,
|
1407
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
|
1408
|
+
<p>Writer function for log entries. A log entry is a collection of one or more
|
1409
|
+
<a href="glib-Message-Logging.html#GLogField"><span class="type">GLogFields</span></a>, using the standard <a class="ulink" href="https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html" target="_top">field names from journal
|
1410
|
+
specification</a>.
|
1411
|
+
See <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> for more information.</p>
|
1412
|
+
<p>Writer functions must ignore fields which they do not recognise, unless they
|
1413
|
+
can write arbitrary binary output, as field values may be arbitrary binary.</p>
|
1414
|
+
<p><em class="parameter"><code>log_level</code></em>
|
1415
|
+
is guaranteed to be included in <em class="parameter"><code>fields</code></em>
|
1416
|
+
as the <code class="literal">PRIORITY</code> field,
|
1417
|
+
but is provided separately for convenience of deciding whether or where to
|
1418
|
+
output the log entry.</p>
|
1419
|
+
<div class="refsect3">
|
1420
|
+
<a name="GLogWriterFunc.parameters"></a><h4>Parameters</h4>
|
1421
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1422
|
+
<colgroup>
|
1423
|
+
<col width="150px" class="parameters_name">
|
1424
|
+
<col class="parameters_description">
|
1425
|
+
<col width="200px" class="parameters_annotations">
|
1426
|
+
</colgroup>
|
1427
|
+
<tbody>
|
1428
|
+
<tr>
|
1429
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1430
|
+
<td class="parameter_description"><p>log level of the message</p></td>
|
1431
|
+
<td class="parameter_annotations"> </td>
|
1432
|
+
</tr>
|
1433
|
+
<tr>
|
1434
|
+
<td class="parameter_name"><p>fields</p></td>
|
1435
|
+
<td class="parameter_description"><p> fields forming the message. </p></td>
|
1436
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1437
|
+
</tr>
|
1438
|
+
<tr>
|
1439
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1440
|
+
<td class="parameter_description"><p>number of <em class="parameter"><code>fields</code></em>
|
1441
|
+
</p></td>
|
1442
|
+
<td class="parameter_annotations"> </td>
|
1443
|
+
</tr>
|
1444
|
+
<tr>
|
1445
|
+
<td class="parameter_name"><p>user_data</p></td>
|
1446
|
+
<td class="parameter_description"><p>user data passed to <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a></p></td>
|
1447
|
+
<td class="parameter_annotations"> </td>
|
1448
|
+
</tr>
|
1449
|
+
</tbody>
|
1450
|
+
</table></div>
|
1451
|
+
</div>
|
1452
|
+
<div class="refsect3">
|
1453
|
+
<a name="GLogWriterFunc.returns"></a><h4>Returns</h4>
|
1454
|
+
<p> <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-HANDLED:CAPS"><code class="literal">G_LOG_WRITER_HANDLED</code></a> if the log entry was handled successfully;
|
1455
|
+
<a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-UNHANDLED:CAPS"><code class="literal">G_LOG_WRITER_UNHANDLED</code></a> otherwise</p>
|
1456
|
+
</div>
|
1457
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1458
|
+
</div>
|
1459
|
+
<hr>
|
1460
|
+
<div class="refsect2">
|
1461
|
+
<a name="g-log-set-writer-func"></a><h3>g_log_set_writer_func ()</h3>
|
1462
|
+
<pre class="programlisting"><span class="returnvalue">void</span>
|
1463
|
+
g_log_set_writer_func (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()"><span class="type">GLogWriterFunc</span></a> func</code></em>,
|
1464
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
|
1465
|
+
<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> user_data_free</code></em>);</pre>
|
1466
|
+
<p>Set a writer function which will be called to format and write out each log
|
1467
|
+
message. Each program should set a writer function, or the default writer
|
1468
|
+
(<a class="link" href="glib-Message-Logging.html#g-log-writer-default" title="g_log_writer_default ()"><code class="function">g_log_writer_default()</code></a>) will be used.</p>
|
1469
|
+
<p>Libraries **must not** call this function — only programs are allowed to
|
1470
|
+
install a writer function, as there must be a single, central point where
|
1471
|
+
log messages are formatted and outputted.</p>
|
1472
|
+
<p>There can only be one writer function. It is an error to set more than one.</p>
|
1473
|
+
<div class="refsect3">
|
1474
|
+
<a name="g-log-set-writer-func.parameters"></a><h4>Parameters</h4>
|
1475
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1476
|
+
<colgroup>
|
1477
|
+
<col width="150px" class="parameters_name">
|
1478
|
+
<col class="parameters_description">
|
1479
|
+
<col width="200px" class="parameters_annotations">
|
1480
|
+
</colgroup>
|
1481
|
+
<tbody>
|
1482
|
+
<tr>
|
1483
|
+
<td class="parameter_name"><p>func</p></td>
|
1484
|
+
<td class="parameter_description"><p>log writer function, which must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
|
1485
|
+
<td class="parameter_annotations"> </td>
|
1486
|
+
</tr>
|
1487
|
+
<tr>
|
1488
|
+
<td class="parameter_name"><p>user_data</p></td>
|
1489
|
+
<td class="parameter_description"><p> user data to pass to <em class="parameter"><code>func</code></em>
|
1490
|
+
. </p></td>
|
1491
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> func]</span></td>
|
1492
|
+
</tr>
|
1493
|
+
<tr>
|
1494
|
+
<td class="parameter_name"><p>user_data_free</p></td>
|
1495
|
+
<td class="parameter_description"><p> function to free <em class="parameter"><code>user_data</code></em>
|
1496
|
+
once it’s
|
1497
|
+
finished with, if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
|
1498
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'destroy_data', for callbacks."><span class="acronym">destroy</span></acronym> func]</span></td>
|
1499
|
+
</tr>
|
1500
|
+
</tbody>
|
1501
|
+
</table></div>
|
1502
|
+
</div>
|
1503
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1504
|
+
</div>
|
1505
|
+
<hr>
|
1506
|
+
<div class="refsect2">
|
1507
|
+
<a name="g-log-writer-supports-color"></a><h3>g_log_writer_supports_color ()</h3>
|
1508
|
+
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
1509
|
+
g_log_writer_supports_color (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> output_fd</code></em>);</pre>
|
1510
|
+
<p>Check whether the given <em class="parameter"><code>output_fd</code></em>
|
1511
|
+
file descriptor supports ANSI color
|
1512
|
+
escape sequences. If so, they can safely be used when formatting log
|
1513
|
+
messages.</p>
|
1514
|
+
<div class="refsect3">
|
1515
|
+
<a name="g-log-writer-supports-color.parameters"></a><h4>Parameters</h4>
|
1516
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1517
|
+
<colgroup>
|
1518
|
+
<col width="150px" class="parameters_name">
|
1519
|
+
<col class="parameters_description">
|
1520
|
+
<col width="200px" class="parameters_annotations">
|
1521
|
+
</colgroup>
|
1522
|
+
<tbody><tr>
|
1523
|
+
<td class="parameter_name"><p>output_fd</p></td>
|
1524
|
+
<td class="parameter_description"><p>output file descriptor to check</p></td>
|
1525
|
+
<td class="parameter_annotations"> </td>
|
1526
|
+
</tr></tbody>
|
1527
|
+
</table></div>
|
1528
|
+
</div>
|
1529
|
+
<div class="refsect3">
|
1530
|
+
<a name="g-log-writer-supports-color.returns"></a><h4>Returns</h4>
|
1531
|
+
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if ANSI color escapes are supported, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
|
1532
|
+
</div>
|
1533
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1534
|
+
</div>
|
1535
|
+
<hr>
|
1536
|
+
<div class="refsect2">
|
1537
|
+
<a name="g-log-writer-is-journald"></a><h3>g_log_writer_is_journald ()</h3>
|
1538
|
+
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
|
1539
|
+
g_log_writer_is_journald (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> output_fd</code></em>);</pre>
|
1540
|
+
<p>Check whether the given <em class="parameter"><code>output_fd</code></em>
|
1541
|
+
file descriptor is a connection to the
|
1542
|
+
systemd journal, or something else (like a log file or <code class="literal">stdout</code> or
|
1543
|
+
<code class="literal">stderr</code>).</p>
|
1544
|
+
<div class="refsect3">
|
1545
|
+
<a name="g-log-writer-is-journald.parameters"></a><h4>Parameters</h4>
|
1546
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1547
|
+
<colgroup>
|
1548
|
+
<col width="150px" class="parameters_name">
|
1549
|
+
<col class="parameters_description">
|
1550
|
+
<col width="200px" class="parameters_annotations">
|
1551
|
+
</colgroup>
|
1552
|
+
<tbody><tr>
|
1553
|
+
<td class="parameter_name"><p>output_fd</p></td>
|
1554
|
+
<td class="parameter_description"><p>output file descriptor to check</p></td>
|
1555
|
+
<td class="parameter_annotations"> </td>
|
1556
|
+
</tr></tbody>
|
1557
|
+
</table></div>
|
1558
|
+
</div>
|
1559
|
+
<div class="refsect3">
|
1560
|
+
<a name="g-log-writer-is-journald.returns"></a><h4>Returns</h4>
|
1561
|
+
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>output_fd</code></em>
|
1562
|
+
points to the journal, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
|
1563
|
+
</div>
|
1564
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1565
|
+
</div>
|
1566
|
+
<hr>
|
1567
|
+
<div class="refsect2">
|
1568
|
+
<a name="g-log-writer-format-fields"></a><h3>g_log_writer_format_fields ()</h3>
|
1569
|
+
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
|
1570
|
+
g_log_writer_format_fields (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1571
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1572
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>,
|
1573
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> use_color</code></em>);</pre>
|
1574
|
+
<p>Format a structured log message as a string suitable for outputting to the
|
1575
|
+
terminal (or elsewhere). This will include the values of all fields it knows
|
1576
|
+
how to interpret, which includes <code class="literal">MESSAGE</code> and <code class="literal">GLIB_DOMAIN</code> (see the
|
1577
|
+
documentation for <a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a>). It does not include values from
|
1578
|
+
unknown fields.</p>
|
1579
|
+
<p>The returned string does **not** have a trailing new-line character. It is
|
1580
|
+
encoded in the character set of the current locale, which is not necessarily
|
1581
|
+
UTF-8.</p>
|
1582
|
+
<div class="refsect3">
|
1583
|
+
<a name="g-log-writer-format-fields.parameters"></a><h4>Parameters</h4>
|
1584
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1585
|
+
<colgroup>
|
1586
|
+
<col width="150px" class="parameters_name">
|
1587
|
+
<col class="parameters_description">
|
1588
|
+
<col width="200px" class="parameters_annotations">
|
1589
|
+
</colgroup>
|
1590
|
+
<tbody>
|
1591
|
+
<tr>
|
1592
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1593
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1594
|
+
level</p></td>
|
1595
|
+
<td class="parameter_annotations"> </td>
|
1596
|
+
</tr>
|
1597
|
+
<tr>
|
1598
|
+
<td class="parameter_name"><p>fields</p></td>
|
1599
|
+
<td class="parameter_description"><p> key–value pairs of structured data forming
|
1600
|
+
the log message. </p></td>
|
1601
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1602
|
+
</tr>
|
1603
|
+
<tr>
|
1604
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1605
|
+
<td class="parameter_description"><p>number of elements in the <em class="parameter"><code>fields</code></em>
|
1606
|
+
array</p></td>
|
1607
|
+
<td class="parameter_annotations"> </td>
|
1608
|
+
</tr>
|
1609
|
+
<tr>
|
1610
|
+
<td class="parameter_name"><p>use_color</p></td>
|
1611
|
+
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> to use ANSI color escape sequences when formatting the
|
1612
|
+
message, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> to not</p></td>
|
1613
|
+
<td class="parameter_annotations"> </td>
|
1614
|
+
</tr>
|
1615
|
+
</tbody>
|
1616
|
+
</table></div>
|
1617
|
+
</div>
|
1618
|
+
<div class="refsect3">
|
1619
|
+
<a name="g-log-writer-format-fields.returns"></a><h4>Returns</h4>
|
1620
|
+
<p> string containing the formatted log message, in
|
1621
|
+
the character set of the current locale. </p>
|
1622
|
+
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
|
1623
|
+
</div>
|
1624
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1625
|
+
</div>
|
1626
|
+
<hr>
|
1627
|
+
<div class="refsect2">
|
1628
|
+
<a name="g-log-writer-journald"></a><h3>g_log_writer_journald ()</h3>
|
1629
|
+
<pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
1630
|
+
g_log_writer_journald (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1631
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1632
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>,
|
1633
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
|
1634
|
+
<p>Format a structured log message and send it to the systemd journal as a set
|
1635
|
+
of key–value pairs. All fields are sent to the journal, but if a field has
|
1636
|
+
length zero (indicating program-specific data) then only its key will be
|
1637
|
+
sent.</p>
|
1638
|
+
<p>This is suitable for use as a <a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()"><span class="type">GLogWriterFunc</span></a>.</p>
|
1639
|
+
<p>If GLib has been compiled without systemd support, this function is still
|
1640
|
+
defined, but will always return <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-UNHANDLED:CAPS"><code class="literal">G_LOG_WRITER_UNHANDLED</code></a>.</p>
|
1641
|
+
<div class="refsect3">
|
1642
|
+
<a name="g-log-writer-journald.parameters"></a><h4>Parameters</h4>
|
1643
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1644
|
+
<colgroup>
|
1645
|
+
<col width="150px" class="parameters_name">
|
1646
|
+
<col class="parameters_description">
|
1647
|
+
<col width="200px" class="parameters_annotations">
|
1648
|
+
</colgroup>
|
1649
|
+
<tbody>
|
1650
|
+
<tr>
|
1651
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1652
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1653
|
+
level</p></td>
|
1654
|
+
<td class="parameter_annotations"> </td>
|
1655
|
+
</tr>
|
1656
|
+
<tr>
|
1657
|
+
<td class="parameter_name"><p>fields</p></td>
|
1658
|
+
<td class="parameter_description"><p> key–value pairs of structured data forming
|
1659
|
+
the log message. </p></td>
|
1660
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1661
|
+
</tr>
|
1662
|
+
<tr>
|
1663
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1664
|
+
<td class="parameter_description"><p>number of elements in the <em class="parameter"><code>fields</code></em>
|
1665
|
+
array</p></td>
|
1666
|
+
<td class="parameter_annotations"> </td>
|
1667
|
+
</tr>
|
1668
|
+
<tr>
|
1669
|
+
<td class="parameter_name"><p>user_data</p></td>
|
1670
|
+
<td class="parameter_description"><p>user data passed to <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a></p></td>
|
1671
|
+
<td class="parameter_annotations"> </td>
|
1672
|
+
</tr>
|
1673
|
+
</tbody>
|
1674
|
+
</table></div>
|
1675
|
+
</div>
|
1676
|
+
<div class="refsect3">
|
1677
|
+
<a name="g-log-writer-journald.returns"></a><h4>Returns</h4>
|
1678
|
+
<p> <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-HANDLED:CAPS"><code class="literal">G_LOG_WRITER_HANDLED</code></a> on success, <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-UNHANDLED:CAPS"><code class="literal">G_LOG_WRITER_UNHANDLED</code></a> otherwise</p>
|
1679
|
+
</div>
|
1680
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1681
|
+
</div>
|
1682
|
+
<hr>
|
1683
|
+
<div class="refsect2">
|
1684
|
+
<a name="g-log-writer-standard-streams"></a><h3>g_log_writer_standard_streams ()</h3>
|
1685
|
+
<pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
1686
|
+
g_log_writer_standard_streams (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1687
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1688
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>,
|
1689
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
|
1690
|
+
<p>Format a structured log message and print it to either <code class="literal">stdout</code> or <code class="literal">stderr</code>,
|
1691
|
+
depending on its log level. <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-INFO:CAPS"><code class="literal">G_LOG_LEVEL_INFO</code></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-DEBUG:CAPS"><code class="literal">G_LOG_LEVEL_DEBUG</code></a> messages
|
1692
|
+
are sent to <code class="literal">stdout</code>; all other log levels are sent to <code class="literal">stderr</code>. Only fields
|
1693
|
+
which are understood by this function are included in the formatted string
|
1694
|
+
which is printed.</p>
|
1695
|
+
<p>If the output stream supports ANSI color escape sequences, they will be used
|
1696
|
+
in the output.</p>
|
1697
|
+
<p>A trailing new-line character is added to the log message when it is printed.</p>
|
1698
|
+
<p>This is suitable for use as a <a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()"><span class="type">GLogWriterFunc</span></a>.</p>
|
1699
|
+
<div class="refsect3">
|
1700
|
+
<a name="g-log-writer-standard-streams.parameters"></a><h4>Parameters</h4>
|
1701
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1702
|
+
<colgroup>
|
1703
|
+
<col width="150px" class="parameters_name">
|
1704
|
+
<col class="parameters_description">
|
1705
|
+
<col width="200px" class="parameters_annotations">
|
1706
|
+
</colgroup>
|
1707
|
+
<tbody>
|
1708
|
+
<tr>
|
1709
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1710
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1711
|
+
level</p></td>
|
1712
|
+
<td class="parameter_annotations"> </td>
|
1713
|
+
</tr>
|
1714
|
+
<tr>
|
1715
|
+
<td class="parameter_name"><p>fields</p></td>
|
1716
|
+
<td class="parameter_description"><p> key–value pairs of structured data forming
|
1717
|
+
the log message. </p></td>
|
1718
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1719
|
+
</tr>
|
1720
|
+
<tr>
|
1721
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1722
|
+
<td class="parameter_description"><p>number of elements in the <em class="parameter"><code>fields</code></em>
|
1723
|
+
array</p></td>
|
1724
|
+
<td class="parameter_annotations"> </td>
|
1725
|
+
</tr>
|
1726
|
+
<tr>
|
1727
|
+
<td class="parameter_name"><p>user_data</p></td>
|
1728
|
+
<td class="parameter_description"><p>user data passed to <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a></p></td>
|
1729
|
+
<td class="parameter_annotations"> </td>
|
1730
|
+
</tr>
|
1731
|
+
</tbody>
|
1732
|
+
</table></div>
|
1733
|
+
</div>
|
1734
|
+
<div class="refsect3">
|
1735
|
+
<a name="g-log-writer-standard-streams.returns"></a><h4>Returns</h4>
|
1736
|
+
<p> <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-HANDLED:CAPS"><code class="literal">G_LOG_WRITER_HANDLED</code></a> on success, <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-UNHANDLED:CAPS"><code class="literal">G_LOG_WRITER_UNHANDLED</code></a> otherwise</p>
|
1737
|
+
</div>
|
1738
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1739
|
+
</div>
|
1740
|
+
<hr>
|
1741
|
+
<div class="refsect2">
|
1742
|
+
<a name="g-log-writer-default"></a><h3>g_log_writer_default ()</h3>
|
1743
|
+
<pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogWriterOutput" title="enum GLogWriterOutput"><span class="returnvalue">GLogWriterOutput</span></a>
|
1744
|
+
g_log_writer_default (<em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
|
1745
|
+
<em class="parameter"><code>const <a class="link" href="glib-Message-Logging.html#GLogField" title="struct GLogField"><span class="type">GLogField</span></a> *fields</code></em>,
|
1746
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_fields</code></em>,
|
1747
|
+
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
|
1748
|
+
<p>Format a structured log message and output it to the default log destination
|
1749
|
+
for the platform. On Linux, this is typically the systemd journal, falling
|
1750
|
+
back to <code class="literal">stdout</code> or <code class="literal">stderr</code> if running from the terminal or if output is
|
1751
|
+
being redirected to a file.</p>
|
1752
|
+
<p>Support for other platform-specific logging mechanisms may be added in
|
1753
|
+
future. Distributors of GLib may modify this function to impose their own
|
1754
|
+
(documented) platform-specific log writing policies.</p>
|
1755
|
+
<p>This is suitable for use as a <a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()"><span class="type">GLogWriterFunc</span></a>, and is the default writer used
|
1756
|
+
if no other is set using <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a>.</p>
|
1757
|
+
<p>As with <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a>, this function drops debug and informational
|
1758
|
+
messages unless their log domain (or <code class="literal">all</code>) is listed in the space-separated
|
1759
|
+
<code class="literal">G_MESSAGES_DEBUG</code> environment variable.</p>
|
1760
|
+
<div class="refsect3">
|
1761
|
+
<a name="g-log-writer-default.parameters"></a><h4>Parameters</h4>
|
1762
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1763
|
+
<colgroup>
|
1764
|
+
<col width="150px" class="parameters_name">
|
1765
|
+
<col class="parameters_description">
|
1766
|
+
<col width="200px" class="parameters_annotations">
|
1767
|
+
</colgroup>
|
1768
|
+
<tbody>
|
1769
|
+
<tr>
|
1770
|
+
<td class="parameter_name"><p>log_level</p></td>
|
1771
|
+
<td class="parameter_description"><p>log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>, or a user-defined
|
1772
|
+
level</p></td>
|
1773
|
+
<td class="parameter_annotations"> </td>
|
1774
|
+
</tr>
|
1775
|
+
<tr>
|
1776
|
+
<td class="parameter_name"><p>fields</p></td>
|
1777
|
+
<td class="parameter_description"><p> key–value pairs of structured data forming
|
1778
|
+
the log message. </p></td>
|
1779
|
+
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_fields]</span></td>
|
1780
|
+
</tr>
|
1781
|
+
<tr>
|
1782
|
+
<td class="parameter_name"><p>n_fields</p></td>
|
1783
|
+
<td class="parameter_description"><p>number of elements in the <em class="parameter"><code>fields</code></em>
|
1784
|
+
array</p></td>
|
1785
|
+
<td class="parameter_annotations"> </td>
|
1786
|
+
</tr>
|
1787
|
+
<tr>
|
1788
|
+
<td class="parameter_name"><p>user_data</p></td>
|
1789
|
+
<td class="parameter_description"><p>user data passed to <a class="link" href="glib-Message-Logging.html#g-log-set-writer-func" title="g_log_set_writer_func ()"><code class="function">g_log_set_writer_func()</code></a></p></td>
|
1790
|
+
<td class="parameter_annotations"> </td>
|
1791
|
+
</tr>
|
1792
|
+
</tbody>
|
1793
|
+
</table></div>
|
1794
|
+
</div>
|
1795
|
+
<div class="refsect3">
|
1796
|
+
<a name="g-log-writer-default.returns"></a><h4>Returns</h4>
|
1797
|
+
<p> <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-HANDLED:CAPS"><code class="literal">G_LOG_WRITER_HANDLED</code></a> on success, <a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-UNHANDLED:CAPS"><code class="literal">G_LOG_WRITER_UNHANDLED</code></a> otherwise</p>
|
1798
|
+
</div>
|
1799
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1800
|
+
</div>
|
889
1801
|
</div>
|
890
1802
|
<div class="refsect1">
|
891
1803
|
<a name="glib-Message-Logging.other_details"></a><h2>Types and Values</h2>
|
@@ -919,6 +1831,8 @@ it in any public header files.</p>
|
|
919
1831
|
<pre class="programlisting">#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR)
|
920
1832
|
</pre>
|
921
1833
|
<p>GLib log levels that are considered fatal by default.</p>
|
1834
|
+
<p>This is not used if structured logging is enabled; see
|
1835
|
+
Using Structured Logging.</p>
|
922
1836
|
</div>
|
923
1837
|
<hr>
|
924
1838
|
<div class="refsect2">
|
@@ -1014,6 +1928,88 @@ levels using <a class="link" href="glib-Message-Logging.html#g-log-set-handler"
|
|
1014
1928
|
</table></div>
|
1015
1929
|
</div>
|
1016
1930
|
</div>
|
1931
|
+
<hr>
|
1932
|
+
<div class="refsect2">
|
1933
|
+
<a name="GLogField"></a><h3>struct GLogField</h3>
|
1934
|
+
<pre class="programlisting">struct GLogField {
|
1935
|
+
const gchar *key;
|
1936
|
+
gconstpointer value;
|
1937
|
+
gssize length;
|
1938
|
+
};
|
1939
|
+
</pre>
|
1940
|
+
<p>Structure representing a single field in a structured log entry. See
|
1941
|
+
<a class="link" href="glib-Message-Logging.html#g-log-structured" title="g_log_structured ()"><code class="function">g_log_structured()</code></a> for details.</p>
|
1942
|
+
<p>Log fields may contain arbitrary values, including binary with embedded nul
|
1943
|
+
bytes. If the field contains a string, the string must be UTF-8 encoded and
|
1944
|
+
have a trailing nul byte. Otherwise, <em class="parameter"><code>length</code></em>
|
1945
|
+
must be set to a non-negative
|
1946
|
+
value.</p>
|
1947
|
+
<div class="refsect3">
|
1948
|
+
<a name="GLogField.members"></a><h4>Members</h4>
|
1949
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1950
|
+
<colgroup>
|
1951
|
+
<col width="300px" class="struct_members_name">
|
1952
|
+
<col class="struct_members_description">
|
1953
|
+
<col width="200px" class="struct_members_annotations">
|
1954
|
+
</colgroup>
|
1955
|
+
<tbody>
|
1956
|
+
<tr>
|
1957
|
+
<td class="struct_member_name"><p>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *<em class="structfield"><code><a name="GLogField.key"></a>key</code></em>;</p></td>
|
1958
|
+
<td class="struct_member_description"><p>field name (UTF-8 string)</p></td>
|
1959
|
+
<td class="struct_member_annotations"> </td>
|
1960
|
+
</tr>
|
1961
|
+
<tr>
|
1962
|
+
<td class="struct_member_name"><p><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> <em class="structfield"><code><a name="GLogField.value"></a>value</code></em>;</p></td>
|
1963
|
+
<td class="struct_member_description"><p>field value (arbitrary bytes)</p></td>
|
1964
|
+
<td class="struct_member_annotations"> </td>
|
1965
|
+
</tr>
|
1966
|
+
<tr>
|
1967
|
+
<td class="struct_member_name"><p><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> <em class="structfield"><code><a name="GLogField.length"></a>length</code></em>;</p></td>
|
1968
|
+
<td class="struct_member_description"><p>length of <em class="parameter"><code>value</code></em>
|
1969
|
+
, in bytes, or -1 if it is nul-terminated</p></td>
|
1970
|
+
<td class="struct_member_annotations"> </td>
|
1971
|
+
</tr>
|
1972
|
+
</tbody>
|
1973
|
+
</table></div>
|
1974
|
+
</div>
|
1975
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
1976
|
+
</div>
|
1977
|
+
<hr>
|
1978
|
+
<div class="refsect2">
|
1979
|
+
<a name="GLogWriterOutput"></a><h3>enum GLogWriterOutput</h3>
|
1980
|
+
<p>Return values from <a href="glib-Message-Logging.html#GLogWriterFunc"><span class="type">GLogWriterFuncs</span></a> to indicate whether the given log entry
|
1981
|
+
was successfully handled by the writer, or whether there was an error in
|
1982
|
+
handling it (and hence a fallback writer should be used).</p>
|
1983
|
+
<p>If a <a class="link" href="glib-Message-Logging.html#GLogWriterFunc" title="GLogWriterFunc ()"><span class="type">GLogWriterFunc</span></a> ignores a log entry, it should return
|
1984
|
+
<a class="link" href="glib-Message-Logging.html#G-LOG-WRITER-HANDLED:CAPS"><code class="literal">G_LOG_WRITER_HANDLED</code></a>.</p>
|
1985
|
+
<div class="refsect3">
|
1986
|
+
<a name="GLogWriterOutput.members"></a><h4>Members</h4>
|
1987
|
+
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
1988
|
+
<colgroup>
|
1989
|
+
<col width="300px" class="enum_members_name">
|
1990
|
+
<col class="enum_members_description">
|
1991
|
+
<col width="200px" class="enum_members_annotations">
|
1992
|
+
</colgroup>
|
1993
|
+
<tbody>
|
1994
|
+
<tr>
|
1995
|
+
<td class="enum_member_name"><p><a name="G-LOG-WRITER-HANDLED:CAPS"></a>G_LOG_WRITER_HANDLED</p></td>
|
1996
|
+
<td class="enum_member_description">
|
1997
|
+
<p>Log writer has handled the log entry.</p>
|
1998
|
+
</td>
|
1999
|
+
<td class="enum_member_annotations"> </td>
|
2000
|
+
</tr>
|
2001
|
+
<tr>
|
2002
|
+
<td class="enum_member_name"><p><a name="G-LOG-WRITER-UNHANDLED:CAPS"></a>G_LOG_WRITER_UNHANDLED</p></td>
|
2003
|
+
<td class="enum_member_description">
|
2004
|
+
<p>Log writer could not handle the log entry.</p>
|
2005
|
+
</td>
|
2006
|
+
<td class="enum_member_annotations"> </td>
|
2007
|
+
</tr>
|
2008
|
+
</tbody>
|
2009
|
+
</table></div>
|
2010
|
+
</div>
|
2011
|
+
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
|
2012
|
+
</div>
|
1017
2013
|
</div>
|
1018
2014
|
</div>
|
1019
2015
|
<div class="footer">
|