alternative to assert
[gtkD.git] / src / glib / MessageLog.d
blob47852e88fb201420fd675f4e2f8bf2a11003af33
1 /*
2 * This file is part of duit.
4 * duit 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 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Message-Logging.html
26 * outPack = glib
27 * outFile = MessageLog
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = MessageLog
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * structWrap:
46 * local aliases:
49 module glib.MessageLog;
51 private import glib.glibtypes;
53 private import lib.glib;
55 private import glib.Str;
57 /**
58 * Description
59 * These functions provide support for logging error messages or messages
60 * used for debugging.
61 * There are several built-in levels of messages, defined in GLogLevelFlags.
62 * These can be extended with user-defined levels.
64 public class MessageLog
67 /**
75 /**
76 * Logs an error or debugging message.
77 * If the log level has been set as fatal, the abort()
78 * function is called to terminate the program.
79 * log_domain:
80 * the log domain, usually G_LOG_DOMAIN.
81 * log_level:
82 * the log level, either from GLogLevelFlags or a user-defined level.
83 * format:
84 * the message format. See the printf()
85 * documentation.
86 * ...:
87 * the parameters to insert into the format string.
89 public static void log(char[] logDomain, GLogLevelFlags logLevel, char[] format, ... )
91 // void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...);
92 g_log(Str.toStringz(logDomain), logLevel, Str.toStringz(format));
95 /**
96 * Logs an error or debugging message.
97 * If the log level has been set as fatal, the abort()
98 * function is called to terminate the program.
99 * log_domain:
100 * the log domain.
101 * log_level:
102 * the log level.
103 * format:
104 * the message format. See the printf()
105 * documentation.
106 * args:
107 * the parameters to insert into the format string.
109 public static void logv(char[] logDomain, GLogLevelFlags logLevel, char[] format, void* args)
111 // void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args);
112 g_logv(Str.toStringz(logDomain), logLevel, Str.toStringz(format), args);
121 * Sets the log handler for a domain and a set of log levels.
122 * To handle fatal and recursive messages the log_levels parameter
123 * must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION
124 * bit flags.
125 * Note that since the G_LOG_LEVEL_ERROR log level is always fatal, if
126 * you want to set a handler for this log level you must combine it with
127 * G_LOG_FLAG_FATAL.
128 * Example13.Adding a log handler for all warning messages in the default
129 * (application) domain
130 * g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
131 * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
132 * Example14.Adding a log handler for all critical messages from GTK+
133 * g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
134 * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
135 * Example15.Adding a log handler for all messages from
136 * GLib
137 * g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
138 * | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
139 * log_domain:
140 * the log domain, or NULL for the default "" application domain.
141 * log_levels:
142 * the log levels to apply the log handler for. To handle fatal
143 * and recursive messages as well, combine the log levels with the
144 * G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION bit flags.
145 * log_func:
146 * the log handler function.
147 * user_data:
148 * data passed to the log handler.
149 * Returns:
150 * the id of the new handler.
152 public static uint logSetHandler(char[] logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData)
154 // guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data);
155 return g_log_set_handler(Str.toStringz(logDomain), logLevels, logFunc, userData);
159 * Removes the log handler.
160 * log_domain:
161 * the log domain.
162 * handler_id:
163 * the id of the handler, which was returned in g_log_set_handler().
165 public static void logRemoveHandler(char[] logDomain, uint handlerId)
167 // void g_log_remove_handler (const gchar *log_domain, guint handler_id);
168 g_log_remove_handler(Str.toStringz(logDomain), handlerId);
172 * Sets the message levels which are always fatal, in any log domain.
173 * When a message with any of these levels is logged the program terminates.
174 * You can only set the levels defined by GLib to be fatal.
175 * G_LOG_LEVEL_ERROR is always fatal.
176 * You can also make some message levels
177 * fatal at runtime by setting the G_DEBUG environment variable (see
178 * Running GLib Applications).
179 * fatal_mask:
180 * the mask containing bits set for each level of error which is
181 * to be fatal.
182 * Returns:
183 * the old fatal mask.
185 public static GLogLevelFlags logSetAlwaysFatal(GLogLevelFlags fatalMask)
187 // GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
188 return g_log_set_always_fatal(fatalMask);
192 * Sets the log levels which are fatal in the given domain.
193 * G_LOG_LEVEL_ERROR is always fatal.
194 * log_domain:
195 * the log domain.
196 * fatal_mask:
197 * the new fatal mask.
198 * Returns:
199 * the old fatal mask for the log domain.
201 public static GLogLevelFlags logSetFatalMask(char[] logDomain, GLogLevelFlags fatalMask)
203 // GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);
204 return g_log_set_fatal_mask(Str.toStringz(logDomain), fatalMask);
208 * The default log handler set up by GLib; g_log_set_default_handler()
209 * allows to install an alternate default log handler.
210 * This is used if no log handler has been set for the particular log domain
211 * and log level combination. It outputs the message to stderr or stdout
212 * and if the log level is fatal it calls abort().
213 * stderr is used for levels G_LOG_LEVEL_ERROR, G_LOG_LEVEL_CRITICAL,
214 * G_LOG_LEVEL_WARNING and G_LOG_LEVEL_MESSAGE. stdout is used for the rest.
215 * log_domain:
216 * the log domain of the message.
217 * log_level:
218 * the level of the message.
219 * message:
220 * the message.
221 * unused_data:
222 * data passed from g_log() which is unused.
224 public static void logDefaultHandler(char[] logDomain, GLogLevelFlags logLevel, char[] message, void* unusedData)
226 // void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data);
227 g_log_default_handler(Str.toStringz(logDomain), logLevel, Str.toStringz(message), unusedData);
231 * Installs a default log handler which is used is used if no
232 * log handler has been set for the particular log domain
233 * and log level combination. By default, GLib uses
234 * g_log_default_handler() as default log handler.
235 * log_func:
236 * the log handler function.
237 * user_data:
238 * data passed to the log handler.
239 * Returns:
240 * the previous default log handler
241 * Since 2.6
243 public static GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData)
245 // GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data);
246 return g_log_set_default_handler(logFunc, userData);