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 * These functions provide support for logging error messages 68 * or messages used for debugging. 69 * 70 * There are several built-in levels of messages, defined in 71 * GLogLevelFlags. 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() documentation 87 * args = the parameters to insert into the format string 88 */ 89 public static void logv(string logDomain, GLogLevelFlags logLevel, string format, void* args) 90 { 91 // void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args); 92 g_logv(Str.toStringz(logDomain), logLevel, Str.toStringz(format), args); 93 } 94 95 /** 96 * Sets the log handler for a domain and a set of log levels. 97 * To handle fatal and recursive messages the log_levels parameter 98 * must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION 99 * bit flags. 100 * Note that since the G_LOG_LEVEL_ERROR log level is always fatal, if 101 * you want to set a handler for this log level you must combine it with 102 * G_LOG_FLAG_FATAL. 103 * $(DDOC_COMMENT example) 104 * $(DDOC_COMMENT example) 105 * $(DDOC_COMMENT example) 106 * Params: 107 * logDomain = the log domain, or NULL for the default "" 108 * application domain. [allow-none] 109 * logLevels = the log levels to apply the log handler for. 110 * To handle fatal and recursive messages as well, combine 111 * the log levels with the G_LOG_FLAG_FATAL and 112 * G_LOG_FLAG_RECURSION bit flags. 113 * logFunc = the log handler function 114 * userData = data passed to the log handler 115 * Returns: the id of the new handler 116 */ 117 public static uint logSetHandler(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData) 118 { 119 // guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data); 120 return g_log_set_handler(Str.toStringz(logDomain), logLevels, logFunc, userData); 121 } 122 123 /** 124 * Removes the log handler. 125 * Params: 126 * logDomain = the log domain 127 * handlerId = the id of the handler, which was returned 128 * in g_log_set_handler() 129 */ 130 public static void logRemoveHandler(string logDomain, uint handlerId) 131 { 132 // void g_log_remove_handler (const gchar *log_domain, guint handler_id); 133 g_log_remove_handler(Str.toStringz(logDomain), handlerId); 134 } 135 136 /** 137 * Sets the message levels which are always fatal, in any log domain. 138 * When a message with any of these levels is logged the program terminates. 139 * You can only set the levels defined by GLib to be fatal. 140 * G_LOG_LEVEL_ERROR is always fatal. 141 * You can also make some message levels fatal at runtime by setting 142 * the G_DEBUG environment variable (see 143 * Running GLib Applications). 144 * Params: 145 * fatalMask = the mask containing bits set for each level 146 * of error which is to be fatal 147 * Returns: the old fatal mask 148 */ 149 public static GLogLevelFlags logSetAlwaysFatal(GLogLevelFlags fatalMask) 150 { 151 // GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); 152 return g_log_set_always_fatal(fatalMask); 153 } 154 155 /** 156 * Sets the log levels which are fatal in the given domain. 157 * G_LOG_LEVEL_ERROR is always fatal. 158 * Params: 159 * logDomain = the log domain 160 * fatalMask = the new fatal mask 161 * Returns: the old fatal mask for the log domain 162 */ 163 public static GLogLevelFlags logSetFatalMask(string logDomain, GLogLevelFlags fatalMask) 164 { 165 // GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask); 166 return g_log_set_fatal_mask(Str.toStringz(logDomain), fatalMask); 167 } 168 169 /** 170 * The default log handler set up by GLib; g_log_set_default_handler() 171 * allows to install an alternate default log handler. 172 * This is used if no log handler has been set for the particular log 173 * domain and log level combination. It outputs the message to stderr 174 * or stdout and if the log level is fatal it calls abort(). 175 * The behavior of this log handler can be influenced by a number of 176 * Params: 177 * logDomain = the log domain of the message 178 * logLevel = the level of the message 179 * message = the message 180 * unusedData = data passed from g_log() which is unused 181 */ 182 public static void logDefaultHandler(string logDomain, GLogLevelFlags logLevel, string message, void* unusedData) 183 { 184 // void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data); 185 g_log_default_handler(Str.toStringz(logDomain), logLevel, Str.toStringz(message), unusedData); 186 } 187 188 /** 189 * Installs a default log handler which is used if no 190 * log handler has been set for the particular log domain 191 * and log level combination. By default, GLib uses 192 * g_log_default_handler() as default log handler. 193 * Since 2.6 194 * Params: 195 * logFunc = the log handler function 196 * userData = data passed to the log handler 197 * Returns: the previous default log handler 198 */ 199 public static GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData) 200 { 201 // GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data); 202 return g_log_set_default_handler(logFunc, userData); 203 } 204 }