1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = glib-Message-Logging.html
27  * outPack = glib
28  * outFile = MessageLog
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = MessageLog
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module glib.MessageLog;
54 
55 public  import gtkc.glibtypes;
56 
57 private import gtkc.glib;
58 private import glib.ConstructionException;
59 
60 
61 private import glib.Str;
62 
63 
64 
65 
66 /**
67  * Description
68  * These functions provide support for logging error messages or messages
69  * used for debugging.
70  * There are several built-in levels of messages, defined in GLogLevelFlags.
71  * These can be extended with user-defined levels.
72  */
73 public class MessageLog
74 {
75 	
76 	/**
77 	 */
78 	
79 	/**
80 	 * Logs an error or debugging message.
81 	 * If the log level has been set as fatal, the abort()
82 	 * function is called to terminate the program.
83 	 * Params:
84 	 * logDomain = the log domain.
85 	 * logLevel = the log level.
86 	 * format = the message format. See the printf()
87 	 * documentation.
88 	 * args = the parameters to insert into the format string.
89 	 */
90 	public static void logv(string logDomain, GLogLevelFlags logLevel, string format, void* args)
91 	{
92 		// void g_logv (const gchar *log_domain,  GLogLevelFlags log_level,  const gchar *format,  va_list args);
93 		g_logv(Str.toStringz(logDomain), logLevel, Str.toStringz(format), args);
94 	}
95 	
96 	/**
97 	 * Sets the log handler for a domain and a set of log levels.
98 	 * To handle fatal and recursive messages the log_levels parameter
99 	 * must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION
100 	 * bit flags.
101 	 * Note that since the G_LOG_LEVEL_ERROR log level is always fatal, if
102 	 * you want to set a handler for this log level you must combine it with
103 	 * G_LOG_FLAG_FATAL.
104 	 * $(DDOC_COMMENT example)
105 	 * $(DDOC_COMMENT example)
106 	 * $(DDOC_COMMENT example)
107 	 * Params:
108 	 * logDomain = the log domain, or NULL for the default "" application domain.
109 	 * logLevels = the log levels to apply the log handler for. To handle fatal
110 	 * and recursive messages as well, combine the log levels with the
111 	 * G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION bit flags.
112 	 * logFunc = the log handler function.
113 	 * userData = data passed to the log handler.
114 	 * Returns: the id of the new handler.
115 	 */
116 	public static uint logSetHandler(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData)
117 	{
118 		// guint g_log_set_handler (const gchar *log_domain,  GLogLevelFlags log_levels,  GLogFunc log_func,  gpointer user_data);
119 		return g_log_set_handler(Str.toStringz(logDomain), logLevels, logFunc, userData);
120 	}
121 	
122 	/**
123 	 * Removes the log handler.
124 	 * Params:
125 	 * logDomain = the log domain.
126 	 * handlerId = the id of the handler, which was returned in g_log_set_handler().
127 	 */
128 	public static void logRemoveHandler(string logDomain, uint handlerId)
129 	{
130 		// void g_log_remove_handler (const gchar *log_domain,  guint handler_id);
131 		g_log_remove_handler(Str.toStringz(logDomain), handlerId);
132 	}
133 	
134 	/**
135 	 * Sets the message levels which are always fatal, in any log domain.
136 	 * When a message with any of these levels is logged the program terminates.
137 	 * You can only set the levels defined by GLib to be fatal.
138 	 * G_LOG_LEVEL_ERROR is always fatal.
139 	 * You can also make some message levels
140 	 * fatal at runtime by setting the G_DEBUG environment variable (see
141 	 * Running GLib Applications).
142 	 * Params:
143 	 * fatalMask = the mask containing bits set for each level of error which is
144 	 * to be fatal.
145 	 * Returns: the old fatal mask.
146 	 */
147 	public static GLogLevelFlags logSetAlwaysFatal(GLogLevelFlags fatalMask)
148 	{
149 		// GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
150 		return g_log_set_always_fatal(fatalMask);
151 	}
152 	
153 	/**
154 	 * Sets the log levels which are fatal in the given domain.
155 	 * G_LOG_LEVEL_ERROR is always fatal.
156 	 * Params:
157 	 * logDomain = the log domain.
158 	 * fatalMask = the new fatal mask.
159 	 * Returns: the old fatal mask for the log domain.
160 	 */
161 	public static GLogLevelFlags logSetFatalMask(string logDomain, GLogLevelFlags fatalMask)
162 	{
163 		// GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain,  GLogLevelFlags fatal_mask);
164 		return g_log_set_fatal_mask(Str.toStringz(logDomain), fatalMask);
165 	}
166 	
167 	/**
168 	 * The default log handler set up by GLib; g_log_set_default_handler()
169 	 * allows to install an alternate default log handler.
170 	 * This is used if no log handler has been set for the particular log domain
171 	 * and log level combination. It outputs the message to stderr or stdout
172 	 * and if the log level is fatal it calls abort().
173 	 * stderr is used for levels G_LOG_LEVEL_ERROR, G_LOG_LEVEL_CRITICAL,
174 	 * G_LOG_LEVEL_WARNING and G_LOG_LEVEL_MESSAGE. stdout is used for the rest.
175 	 * Params:
176 	 * logDomain = the log domain of the message.
177 	 * logLevel = the level of the message.
178 	 * message = the message.
179 	 * unusedData = data passed from g_log() which is unused.
180 	 */
181 	public static void logDefaultHandler(string logDomain, GLogLevelFlags logLevel, string message, void* unusedData)
182 	{
183 		// void g_log_default_handler (const gchar *log_domain,  GLogLevelFlags log_level,  const gchar *message,  gpointer unused_data);
184 		g_log_default_handler(Str.toStringz(logDomain), logLevel, Str.toStringz(message), unusedData);
185 	}
186 	
187 	/**
188 	 * Installs a default log handler which is used if no
189 	 * log handler has been set for the particular log domain
190 	 * and log level combination. By default, GLib uses
191 	 * g_log_default_handler() as default log handler.
192 	 * Since 2.6
193 	 * Params:
194 	 * logFunc = the log handler function.
195 	 * userData = data passed to the log handler.
196 	 * Returns: the previous default log handler
197 	 */
198 	public static GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData)
199 	{
200 		// GLogFunc g_log_set_default_handler (GLogFunc log_func,  gpointer user_data);
201 		return g_log_set_default_handler(logFunc, userData);
202 	}
203 }