comparison src/log.h @ 11503:cd0c8830d881

[gaim-migrate @ 13748] Making gaim_log_logger a varargs function so it can be expanded as GaimLogLogger expands, without breaking compatibility. I'm anticipating adding a find() function some day for a database logger. This commit also makes use of gaim_log_logger_new() everywhere it should be used, removing the old static structures. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 11 Sep 2005 05:14:52 +0000
parents ef9280fdc511
children a1e241dd50b6
comparison
equal deleted inserted replaced
11502:b858f992b566 11503:cd0c8830d881
140 struct _GaimLogSet { 140 struct _GaimLogSet {
141 GaimLogType type; /**< The type of logs available */ 141 GaimLogType type; /**< The type of logs available */
142 char *name; /**< The name of the logs available */ 142 char *name; /**< The name of the logs available */
143 GaimAccount *account; /**< The account the available logs 143 GaimAccount *account; /**< The account the available logs
144 took place on. This will be 144 took place on. This will be
145 NULL if the account no longer 145 @c NULL if the account no longer
146 exists. (Depending on a 146 exists. (Depending on a
147 logger's implementation of 147 logger's implementation of
148 list, it may not be possible 148 list, it may not be possible
149 to load such logs.) */ 149 to load such logs.) */
150 gboolean buddy; /**< Is this (account, name) a buddy 150 gboolean buddy; /**< Is this (account, name) a buddy
188 /** 188 /**
189 * Writes to a log file. Assumes you have checked preferences already. 189 * Writes to a log file. Assumes you have checked preferences already.
190 * 190 *
191 * @param log The log to write to 191 * @param log The log to write to
192 * @param type The type of message being logged 192 * @param type The type of message being logged
193 * @param from Whom this message is coming from, or NULL for 193 * @param from Whom this message is coming from, or @c NULL for
194 * system messages 194 * system messages
195 * @param time A timestamp in UNIX time 195 * @param time A timestamp in UNIX time
196 * @param message The message to log 196 * @param message The message to log
197 */ 197 */
198 void gaim_log_write(GaimLog *log, 198 void gaim_log_write(GaimLog *log,
357 /*@{*/ 357 /*@{*/
358 358
359 /** 359 /**
360 * Creates a new logger 360 * Creates a new logger
361 * 361 *
362 * @param create The logger's new function. 362 * @param id The logger's id.
363 * @param write The logger's write function. 363 * @param name The logger's name.
364 * @param finalize The logger's finalize function. 364 * @param functions The number of functions being passed. The following
365 * @param list The logger's list function. 365 * functions are currently available (in order): @c create,
366 * @param read The logger's read function. 366 * @c write, @c finalize, @c list, @c read, @c size,
367 * @param size The logger's size function. 367 * @c total_size, @c list_syslog, @c get_log_sets. For
368 * @param total_size The logger's total_size function. 368 * details on these functions, see GaimLogLogger.
369 * @param list_syslog The logger's list_syslog function. 369 * Functions may not be skipped. For example, passing
370 * @param get_log_sets The logger's get_log_sets function. 370 * @c create and @c write is acceptable (for a total of
371 * two functions). Passing @c create and @c finalize,
372 * however, is not. To accomplish that, the caller must
373 * pass @c create, @c NULL (a placeholder for @c write),
374 * and @c finalize (for a total of 3 functions).
371 * 375 *
372 * @return The new logger 376 * @return The new logger
373 */ 377 */
374 GaimLogLogger *gaim_log_logger_new( 378 GaimLogLogger *gaim_log_logger_new(const char *id, const char *name, int functions, ...);
375 void(*create)(GaimLog *),
376 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *),
377 void(*finalize)(GaimLog *),
378 GList*(*list)(GaimLogType type, const char*, GaimAccount*),
379 char*(*read)(GaimLog*, GaimLogReadFlags*),
380 int(*size)(GaimLog*),
381 int(*total_size)(GaimLogType type, const char *name, GaimAccount *account),
382 GList*(*list_syslog)(GaimAccount *account),
383 void(*get_log_sets)(GaimLogSetCallback cb, GHashTable *sets));
384 379
385 /** 380 /**
386 * Frees a logger 381 * Frees a logger
387 * 382 *
388 * @param logger The logger to free 383 * @param logger The logger to free