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 private import glib.Str; 61 62 63 64 /** 65 * These functions provide support for logging error messages 66 * or messages used for debugging. 67 * 68 * There are several built-in levels of messages, defined in 69 * GLogLevelFlags. These can be extended with user-defined levels. 70 */ 71 public class MessageLog 72 { 73 74 /** 75 */ 76 77 /** 78 * Logs an error or debugging message. 79 * If the log level has been set as fatal, the abort() 80 * function is called to terminate the program. 81 * Params: 82 * logDomain = the log domain 83 * logLevel = the log level 84 * format = the message format. See the printf() documentation 85 * args = the parameters to insert into the format string 86 */ 87 public static void logv(string logDomain, GLogLevelFlags logLevel, string format, void* args) 88 { 89 // void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args); 90 g_logv(Str.toStringz(logDomain), logLevel, Str.toStringz(format), args); 91 } 92 93 /** 94 * Sets the log handler for a domain and a set of log levels. 95 * To handle fatal and recursive messages the log_levels parameter 96 * must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION 97 * bit flags. 98 * Note that since the G_LOG_LEVEL_ERROR log level is always fatal, if 99 * you want to set a handler for this log level you must combine it with 100 * G_LOG_FLAG_FATAL. 101 * $(DDOC_COMMENT example) 102 * $(DDOC_COMMENT example) 103 * $(DDOC_COMMENT example) 104 * Params: 105 * logDomain = the log domain, or NULL for the default "" 106 * application domain. [allow-none] 107 * logLevels = the log levels to apply the log handler for. 108 * To handle fatal and recursive messages as well, combine 109 * the log levels with the G_LOG_FLAG_FATAL and 110 * G_LOG_FLAG_RECURSION bit flags. 111 * logFunc = the log handler function 112 * userData = data passed to the log handler 113 * Returns: the id of the new handler 114 */ 115 public static uint logSetHandler(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData) 116 { 117 // guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data); 118 return g_log_set_handler(Str.toStringz(logDomain), logLevels, logFunc, userData); 119 } 120 121 /** 122 * Removes the log handler. 123 * Params: 124 * logDomain = the log domain 125 * handlerId = the id of the handler, which was returned 126 * 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 fatal at runtime by setting 140 * the G_DEBUG environment variable (see 141 * Running GLib Applications). 142 * Params: 143 * fatalMask = the mask containing bits set for each level 144 * of error which is 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 171 * domain and log level combination. It outputs the message to stderr 172 * or stdout and if the log level is fatal it calls abort(). 173 * The behavior of this log handler can be influenced by a number of 174 * Params: 175 * logDomain = the log domain of the message 176 * logLevel = the level of the message 177 * message = the message 178 * unusedData = data passed from g_log() which is unused 179 */ 180 public static void logDefaultHandler(string logDomain, GLogLevelFlags logLevel, string message, void* unusedData) 181 { 182 // void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data); 183 g_log_default_handler(Str.toStringz(logDomain), logLevel, Str.toStringz(message), unusedData); 184 } 185 186 /** 187 * Installs a default log handler which is used if no 188 * log handler has been set for the particular log domain 189 * and log level combination. By default, GLib uses 190 * g_log_default_handler() as default log handler. 191 * Since 2.6 192 * Params: 193 * logFunc = the log handler function 194 * userData = data passed to the log handler 195 * Returns: the previous default log handler 196 */ 197 public static GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData) 198 { 199 // GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data); 200 return g_log_set_default_handler(logFunc, userData); 201 } 202 }