⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messages.sgml

📁 GLib是GTK+和GNOME工程的基础底层核心程序库
💻 SGML
📖 第 1 页 / 共 2 页
字号:
<entry>the parameters to insert into the format string.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-warning">g_warning()</title><programlisting>#define     g_warning(...)</programlisting><para>A convenience function/macro to log a warning message.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>...</parameter>&nbsp;:</entry><entry>format string, followed by parameters to insert into the format string (as with <function>printf()</function>)</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-critical">g_critical()</title><programlisting>#define     g_critical(...)</programlisting><para>Logs a "critical warning" (<link linkend="G-LOG-LEVEL-CRITICAL-CAPS">G_LOG_LEVEL_CRITICAL</link>). It's more or lessapplication-defined what constitutes a critical vs. a regularwarning. You could call <link linkend="g-log-set-always-fatal">g_log_set_always_fatal</link>() to make criticalwarnings exit the program, then use <link linkend="g-critical">g_critical</link>() for fatal errors, forexample.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>...</parameter>&nbsp;:</entry><entry>format string, followed by parameters to insert into the format string (as with <function>printf()</function>)</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-error">g_error()</title><programlisting>#define     g_error(...)</programlisting><para>A convenience function/macro to log an error message.Error messages are always fatal, resulting in a call to<function><link linkend="abort">abort</link>()</function> to terminate the application.This function will result in a core dump; don't use it for errors youexpect. Using this function indicates a bug in your program, i.e. anassertion failure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>...</parameter>&nbsp;:</entry><entry>the parameters to insert into the format string.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-log-set-handler">g_log_set_handler ()</title><programlisting><link linkend="guint">guint</link>       g_log_set_handler               (const <link linkend="gchar">gchar</link> *log_domain,                                             <link linkend="GLogLevelFlags">GLogLevelFlags</link> log_levels,                                             <link linkend="GLogFunc">GLogFunc</link> log_func,                                             <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Sets the log handler for a domain and a set of log levels.To handle fatal and recursive messages the <parameter>log_levels</parameter> parametermust be combined with the <link linkend="G-LOG-FLAG-FATAL-CAPS">G_LOG_FLAG_FATAL</link> and <link linkend="G-LOG-FLAG-RECURSIVE-CAPS">G_LOG_FLAG_RECURSIVE</link> bit flags.</para><para>Note that since the <link linkend="G-LOG-LEVEL-ERROR-CAPS">G_LOG_LEVEL_ERROR</link> log level is always fatal, if you wantto set a handler for this log level you must combine it with <link linkend="G-LOG-FLAG-FATAL-CAPS">G_LOG_FLAG_FATAL</link>.</para><example><title>Adding a log handler for all warning messages in the default (application) domain</title><programlisting>  g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL                     | G_LOG_FLAG_RECURSIVE, my_log_handler, NULL);</programlisting></example><example><title>Adding a log handler for all critical messages from GTK+</title><programlisting>  g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL                     | G_LOG_FLAG_RECURSIVE, my_log_handler, NULL);</programlisting></example><example><title>Adding a log handler for <emphasis>all</emphasis> messages from GLib</title><programlisting>  g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL                     | G_LOG_FLAG_RECURSIVE, my_log_handler, NULL);</programlisting></example><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>log_domain</parameter>&nbsp;:</entry><entry>the log domain, or <literal>NULL</literal> for the default "" application domain.</entry></row><row><entry align="right"><parameter>log_levels</parameter>&nbsp;:</entry><entry>the log levels to apply the log handler for. To handle fataland recursive messages as well, combine the log levels with the<link linkend="G-LOG-FLAG-FATAL-CAPS">G_LOG_FLAG_FATAL</link> and <link linkend="G-LOG-FLAG-RECURSIVE-CAPS">G_LOG_FLAG_RECURSIVE</link> bit flags.</entry></row><row><entry align="right"><parameter>log_func</parameter>&nbsp;:</entry><entry>the log handler function.</entry></row><row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry><entry>data passed to the log handler.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the id of the new handler.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-log-remove-handler">g_log_remove_handler ()</title><programlisting>void        g_log_remove_handler            (const <link linkend="gchar">gchar</link> *log_domain,                                             <link linkend="guint">guint</link> handler_id);</programlisting><para>Removes the log handler.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>log_domain</parameter>&nbsp;:</entry><entry>the log domain.</entry></row><row><entry align="right"><parameter>handler_id</parameter>&nbsp;:</entry><entry>the id of the handler, which was returned in <link linkend="g-log-set-handler">g_log_set_handler</link>().</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-log-set-always-fatal">g_log_set_always_fatal ()</title><programlisting><link linkend="GLogLevelFlags">GLogLevelFlags</link> g_log_set_always_fatal       (<link linkend="GLogLevelFlags">GLogLevelFlags</link> fatal_mask);</programlisting><para>Sets the message levels which are always fatal, in any log domain.When a message with any of these levels is logged the program terminates.You can only set the levels defined by GLib to be fatal.<literal>G_LOG_LEVEL_ERROR</literal> is always fatal.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>fatal_mask</parameter>&nbsp;:</entry><entry>the mask containing bits set for each level of error which isto be fatal.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the old fatal mask.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-log-set-fatal-mask">g_log_set_fatal_mask ()</title><programlisting><link linkend="GLogLevelFlags">GLogLevelFlags</link> g_log_set_fatal_mask         (const <link linkend="gchar">gchar</link> *log_domain,                                             <link linkend="GLogLevelFlags">GLogLevelFlags</link> fatal_mask);</programlisting><para>Sets the log levels which are fatal in the given domain.<literal>G_LOG_LEVEL_ERROR</literal> is always fatal.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>log_domain</parameter>&nbsp;:</entry><entry>the log domain.</entry></row><row><entry align="right"><parameter>fatal_mask</parameter>&nbsp;:</entry><entry>the new fatal mask.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the old fatal mask for the log domain.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-log-default-handler">g_log_default_handler ()</title><programlisting>void        g_log_default_handler           (const <link linkend="gchar">gchar</link> *log_domain,                                             <link linkend="GLogLevelFlags">GLogLevelFlags</link> log_level,                                             const <link linkend="gchar">gchar</link> *message,                                             <link linkend="gpointer">gpointer</link> unused_data);</programlisting><para>The default log handler.This is used if no log handler has been set for the particular log domainand log level combination. It outputs the message to stderr or stdoutand if the log level is fatal it calls <function><link linkend="abort">abort</link>()</function>.</para><para>stderr is used for levels <literal>G_LOG_LEVEL_ERROR</literal>, <literal>G_LOG_LEVEL_CRITICAL</literal>, and<literal>G_LOG_LEVEL_WARNING</literal>. stdout is used for the rest.(On the Windows platform, stdout is always used.)</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>log_domain</parameter>&nbsp;:</entry><entry>the log domain of the message.</entry></row><row><entry align="right"><parameter>log_level</parameter>&nbsp;:</entry><entry>the level of the message.</entry></row><row><entry align="right"><parameter>message</parameter>&nbsp;:</entry><entry>the message.</entry></row><row><entry align="right"><parameter>unused_data</parameter>&nbsp;:</entry><entry>data passed from <link linkend="g-log">g_log</link>() which is unused.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -