/* IRCfs - IRC FileServ for *nix. * Copyright (C) 2002 Nick 'Zaf' Clifford * For licensing details, refer to the LICENSE file in the source * code directory. */ #ifndef __include_debug_h__ #define __include_debug_h__ struct debug; typedef struct debug *DEBUG; struct debug *debug_register(const char *module_name); enum debug_levels { D_ALL=0, D_DEBUG=1, D_INFO=10, D_NOTICE=20, D_WARN=30, D_ERROR=40, D_CRIT=50, D_NONE=99 }; #define debug(dbh,format, ...) __debug(dbh,D_DEBUG,__LINE__,__FILE__,format, ## __VA_ARGS__) #define error(dbh,format, ...) __debug(dbh,D_ERROR,__LINE__,__FILE__,format, ## __VA_ARGS__) #define warn(dbh,format, ...) __debug(dbh,D_WARN,__LINE__,__FILE__,format, ## __VA_ARGS__) #define critical(dbh,format, ...) __debug(dbh,D_CRIT,__LINE__,__FILE__,format, ## __VA_ARGS__) #define notice(dbh,format, ...) __debug(dbh,D_NOTICE,__LINE__,__FILE__,format, ## __VA_ARGS__) #define info(dbh,format, ...) __debug(dbh,D_INFO,__LINE__,__FILE__,format, ## __VA_ARGS__) #define logmsg(dbh,level,format, ...) __debug(dbh,level,__LINE__,__FILE__,format, ## __VA_ARGS__) void __debug(struct debug *dbh, enum debug_levels level, int line, const char *file, const char *format, ...); void debug_off(struct debug *dbh); void debug_filter(struct debug *dbh, enum debug_levels level); void close_debug(struct debug *dbh); extern DEBUG debug_error; struct debug *debug_find_handler(const char *module_name); int debug_load_config_opts(); #endif