source: appstream-generator/build/girepo/glib/MessageLog.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 7.7 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module glib.MessageLog;
22
23private import gi.glib;
24public  import gi.glibtypes;
25private import glib.Str;
26
27
28/** */
29public struct MessageLog
30{
31
32        /**
33         * The default log handler set up by GLib; g_log_set_default_handler()
34         * allows to install an alternate default log handler.
35         * This is used if no log handler has been set for the particular log
36         * domain and log level combination. It outputs the message to stderr
37         * or stdout and if the log level is fatal it calls abort(). It automatically
38         * prints a new-line character after the message, so one does not need to be
39         * manually included in @message.
40         *
41         * The behavior of this log handler can be influenced by a number of
42         * environment variables:
43         *
44         * - `G_MESSAGES_PREFIXED`: A :-separated list of log levels for which
45         * messages should be prefixed by the program name and PID of the
46         * aplication.
47         *
48         * - `G_MESSAGES_DEBUG`: A space-separated list of log domains for
49         * which debug and informational messages are printed. By default
50         * these messages are not printed.
51         *
52         * stderr is used for levels %G_LOG_LEVEL_ERROR, %G_LOG_LEVEL_CRITICAL,
53         * %G_LOG_LEVEL_WARNING and %G_LOG_LEVEL_MESSAGE. stdout is used for
54         * the rest.
55         *
56         * Params:
57         *     logDomain = the log domain of the message
58         *     logLevel = the level of the message
59         *     message = the message
60         *     unusedData = data passed from g_log() which is unused
61         */
62        public static void logDefaultHandler(string logDomain, GLogLevelFlags logLevel, string message, void* unusedData)
63        {
64                g_log_default_handler(Str.toStringz(logDomain), logLevel, Str.toStringz(message), unusedData);
65        }
66
67        /**
68         * Removes the log handler.
69         *
70         * Params:
71         *     logDomain = the log domain
72         *     handlerId = the id of the handler, which was returned
73         *         in g_log_set_handler()
74         */
75        public static void logRemoveHandler(string logDomain, uint handlerId)
76        {
77                g_log_remove_handler(Str.toStringz(logDomain), handlerId);
78        }
79
80        /**
81         * Sets the message levels which are always fatal, in any log domain.
82         * When a message with any of these levels is logged the program terminates.
83         * You can only set the levels defined by GLib to be fatal.
84         * %G_LOG_LEVEL_ERROR is always fatal.
85         *
86         * You can also make some message levels fatal at runtime by setting
87         * the `G_DEBUG` environment variable (see
88         * [Running GLib Applications](glib-running.html)).
89         *
90         * Params:
91         *     fatalMask = the mask containing bits set for each level
92         *         of error which is to be fatal
93         *
94         * Returns: the old fatal mask
95         */
96        public static GLogLevelFlags logSetAlwaysFatal(GLogLevelFlags fatalMask)
97        {
98                return g_log_set_always_fatal(fatalMask);
99        }
100
101        /**
102         * Installs a default log handler which is used if no
103         * log handler has been set for the particular log domain
104         * and log level combination. By default, GLib uses
105         * g_log_default_handler() as default log handler.
106         *
107         * Params:
108         *     logFunc = the log handler function
109         *     userData = data passed to the log handler
110         *
111         * Returns: the previous default log handler
112         *
113         * Since: 2.6
114         */
115        public static GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData)
116        {
117                return g_log_set_default_handler(logFunc, userData);
118        }
119
120        /**
121         * Sets the log levels which are fatal in the given domain.
122         * %G_LOG_LEVEL_ERROR is always fatal.
123         *
124         * Params:
125         *     logDomain = the log domain
126         *     fatalMask = the new fatal mask
127         *
128         * Returns: the old fatal mask for the log domain
129         */
130        public static GLogLevelFlags logSetFatalMask(string logDomain, GLogLevelFlags fatalMask)
131        {
132                return g_log_set_fatal_mask(Str.toStringz(logDomain), fatalMask);
133        }
134
135        /**
136         * Sets the log handler for a domain and a set of log levels.
137         * To handle fatal and recursive messages the @log_levels parameter
138         * must be combined with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION
139         * bit flags.
140         *
141         * Note that since the #G_LOG_LEVEL_ERROR log level is always fatal, if
142         * you want to set a handler for this log level you must combine it with
143         * #G_LOG_FLAG_FATAL.
144         *
145         * Here is an example for adding a log handler for all warning messages
146         * in the default domain:
147         * |[<!-- language="C" -->
148         * g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
149         * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
150         * ]|
151         *
152         * This example adds a log handler for all critical messages from GTK+:
153         * |[<!-- language="C" -->
154         * g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
155         * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
156         * ]|
157         *
158         * This example adds a log handler for all messages from GLib:
159         * |[<!-- language="C" -->
160         * g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
161         * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
162         * ]|
163         *
164         * Params:
165         *     logDomain = the log domain, or %NULL for the default ""
166         *         application domain
167         *     logLevels = the log levels to apply the log handler for.
168         *         To handle fatal and recursive messages as well, combine
169         *         the log levels with the #G_LOG_FLAG_FATAL and
170         *         #G_LOG_FLAG_RECURSION bit flags.
171         *     logFunc = the log handler function
172         *     userData = data passed to the log handler
173         *
174         * Returns: the id of the new handler
175         */
176        public static uint logSetHandler(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData)
177        {
178                return g_log_set_handler(Str.toStringz(logDomain), logLevels, logFunc, userData);
179        }
180
181        /**
182         * Like g_log_sets_handler(), but takes a destroy notify for the @user_data.
183         *
184         * Params:
185         *     logDomain = the log domain, or %NULL for the default ""
186         *         application domain
187         *     logLevels = the log levels to apply the log handler for.
188         *         To handle fatal and recursive messages as well, combine
189         *         the log levels with the #G_LOG_FLAG_FATAL and
190         *         #G_LOG_FLAG_RECURSION bit flags.
191         *     logFunc = the log handler function
192         *     userData = data passed to the log handler
193         *     destroy = destroy notify for @user_data, or %NULL
194         *
195         * Returns: the id of the new handler
196         *
197         * Since: 2.46
198         */
199        public static uint logSetHandlerFull(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData, GDestroyNotify destroy)
200        {
201                return g_log_set_handler_full(Str.toStringz(logDomain), logLevels, logFunc, userData, destroy);
202        }
203
204        /**
205         * Logs an error or debugging message.
206         *
207         * If the log level has been set as fatal, the abort()
208         * function is called to terminate the program.
209         *
210         * If g_log_default_handler() is used as the log handler function, a new-line
211         * character will automatically be appended to @..., and need not be entered
212         * manually.
213         *
214         * Params:
215         *     logDomain = the log domain
216         *     logLevel = the log level
217         *     format = the message format. See the printf() documentation
218         *     args = the parameters to insert into the format string
219         */
220        public static void logv(string logDomain, GLogLevelFlags logLevel, string format, void* args)
221        {
222                g_logv(Str.toStringz(logDomain), logLevel, Str.toStringz(format), args);
223        }
224}
Note: See TracBrowser for help on using the repository browser.