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

📄 glib-message-logging.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<td>log level for warnings, see <a class="link" href="glib-Message-Logging.html#g-warning"><code class="function">g_warning()</code></a></td></tr><tr><td><p><span class="term"><a name="G-LOG-LEVEL-MESSAGE:CAPS"></a><code class="literal">G_LOG_LEVEL_MESSAGE</code></span></p></td><td>log level for messages, see <a class="link" href="glib-Message-Logging.html#g-message"><code class="function">g_message()</code></a></td></tr><tr><td><p><span class="term"><a name="G-LOG-LEVEL-INFO:CAPS"></a><code class="literal">G_LOG_LEVEL_INFO</code></span></p></td><td>log level for informational messages</td></tr><tr><td><p><span class="term"><a name="G-LOG-LEVEL-DEBUG:CAPS"></a><code class="literal">G_LOG_LEVEL_DEBUG</code></span></p></td><td>log level for debug messages, see <a class="link" href="glib-Message-Logging.html#g-debug"><code class="function">g_debug()</code></a></td></tr><tr><td><p><span class="term"><a name="G-LOG-LEVEL-MASK:CAPS"></a><code class="literal">G_LOG_LEVEL_MASK</code></span></p></td><td>a mask including all log levels.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958237"></a><h3><a name="g-log"></a>g_log ()</h3><a class="indexterm" name="id2958249"></a><pre class="programlisting">void                g_log                               (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,                                                         <a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         ...);</pre><p>Logs an error or debugging message.If the log level has been set as fatal, the <code class="function">abort()</code>function is called to terminate the program.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>log_domain</code></em>&#160;:</span></p></td><td>the log domain, usually <a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN:CAPS"><span class="type">G_LOG_DOMAIN</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>log_level</code></em>&#160;:</span></p></td><td>the log level, either from <a class="link" href="glib-Message-Logging.html#GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> or a user-defined level.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em>&#160;:</span></p></td><td>the message format. See the <code class="function">printf()</code>documentation.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>the parameters to insert into the format string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958397"></a><h3><a name="g-logv"></a>g_logv ()</h3><a class="indexterm" name="id2958409"></a><pre class="programlisting">void                g_logv                              (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,                                                         <a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         va_list args);</pre><p>Logs an error or debugging message.If the log level has been set as fatal, the <code class="function">abort()</code>function is called to terminate the program.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>log_domain</code></em>&#160;:</span></p></td><td>the log domain.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>log_level</code></em>&#160;:</span></p></td><td>the log level.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em>&#160;:</span></p></td><td>the message format. See the <code class="function">printf()</code>documentation.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em>&#160;:</span></p></td><td>the parameters to insert into the format string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958545"></a><h3><a name="g-message"></a>g_message()</h3><a class="indexterm" name="id2958558"></a><pre class="programlisting">#define             g_message(...)</pre><p>A convenience function/macro to log a normal message.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958603"></a><h3><a name="g-warning"></a>g_warning()</h3><a class="indexterm" name="id2958616"></a><pre class="programlisting">#define             g_warning(...)</pre><p>A convenience function/macro to log a warning message.</p><p>You can make warnings fatal at runtime by setting the <code class="literal">G_DEBUG</code> environmentvariable (see <a class="ulink" href="glib-running.html" target="_top">Running GLib Applications</a>).</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958684"></a><h3><a name="g-critical"></a>g_critical()</h3><a class="indexterm" name="id2958697"></a><pre class="programlisting">#define             g_critical(...)</pre><p>Logs a "critical warning" (<a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-CRITICAL:CAPS"><span class="type">G_LOG_LEVEL_CRITICAL</span></a>). It's more or lessapplication-defined what constitutes a critical vs. a regularwarning. You could call <a class="link" href="glib-Message-Logging.html#g-log-set-always-fatal"><code class="function">g_log_set_always_fatal()</code></a> to make criticalwarnings exit the program, then use <a class="link" href="glib-Message-Logging.html#g-critical"><code class="function">g_critical()</code></a> for fatal errors, forexample.</p><p>You can also make critical warnings fatal at runtime by settingthe <code class="literal">G_DEBUG</code> environment variable (see<a class="ulink" href="glib-running.html" target="_top">Running GLib Applications</a>).</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958798"></a><h3><a name="g-error"></a>g_error()</h3><a class="indexterm" name="id2958810"></a><pre class="programlisting">#define             g_error(...)</pre><p>A convenience function/macro to log an error message.Error messages are always fatal, resulting in a call to<code class="function">abort()</code> 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.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2958870"></a><h3><a name="g-debug"></a>g_debug()</h3><a class="indexterm" name="id2958885"></a><pre class="programlisting">#define             g_debug(...)</pre><p>A convenience function/macro to log a debug message.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id2958937"></a><h3><a name="g-log-set-handler"></a>g_log_set_handler ()</h3><a class="indexterm" name="id2958951"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_log_set_handler                   (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,                                                         <a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_levels,                                                         <a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> log_func,                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Sets the log handler for a domain and a set of log levels.To handle fatal and recursive messages the <em class="parameter"><code>log_levels</code></em> parametermust be combined with the <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL:CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-RECURSION:CAPS"><span class="type">G_LOG_FLAG_RECURSION</span></a> bit flags.</p><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 you want to set a handler for this log level you must combine it with <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL:CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a>.</p><div class="example">

⌨️ 快捷键说明

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