5 This file is part of catta.
7 catta is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
12 catta is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15 Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with catta; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <catta/cdecl.h>
26 #include <catta/gccmacro.h>
28 /** \file log.h Extensible logging subsystem */
32 /** Log level for catta_log_xxx() */
34 CATTA_LOG_ERROR = 0, /**< Error messages */
35 CATTA_LOG_WARN = 1, /**< Warning messages */
36 CATTA_LOG_NOTICE = 2, /**< Notice messages */
37 CATTA_LOG_INFO = 3, /**< Info messages */
38 CATTA_LOG_DEBUG = 4, /**< Debug messages */
42 /** Prototype for a user supplied log function */
43 typedef void (*CattaLogFunction)(CattaLogLevel level, const char *txt);
45 /** Set a user supplied log function, replacing the default which
46 * prints to log messages unconditionally to STDERR. Pass NULL for
47 * resetting to the default log function */
48 void catta_set_log_function(CattaLogFunction function);
50 /** Issue a log message using a va_list object */
51 void catta_log_ap(CattaLogLevel level, const char *format, va_list ap);
53 /** Issue a log message by passing a log level and a format string */
54 void catta_log(CattaLogLevel level, const char*format, ...) CATTA_GCC_PRINTF_ATTR23;
56 /** Shortcut for catta_log(CATTA_LOG_ERROR, ...) */
57 void catta_log_error(const char*format, ...) CATTA_GCC_PRINTF_ATTR12;
59 /** Shortcut for catta_log(CATTA_LOG_WARN, ...) */
60 void catta_log_warn(const char*format, ...) CATTA_GCC_PRINTF_ATTR12;
62 /** Shortcut for catta_log(CATTA_LOG_NOTICE, ...) */
63 void catta_log_notice(const char*format, ...) CATTA_GCC_PRINTF_ATTR12;
65 /** Shortcut for catta_log(CATTA_LOG_INFO, ...) */
66 void catta_log_info(const char*format, ...) CATTA_GCC_PRINTF_ATTR12;
68 /** Shortcut for catta_log(CATTA_LOG_DEBUG, ...) */
69 void catta_log_debug(const char*format, ...) CATTA_GCC_PRINTF_ATTR12;