X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/5aff007d8fcfb4c6cc3c3627ae15f45562db7a0d..7e9608832e6d7f5be6dc176295b3a4c0507444e6:/lib/log.h diff --git a/lib/log.h b/lib/log.h index d112685..f1f55d2 100644 --- a/lib/log.h +++ b/lib/log.h @@ -2,20 +2,21 @@ * This file is part of DisOrder. * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * along with this program. If not, see . + */ +/** @file lib/log.h + * @brief Errors and logging */ #ifndef LOG_H @@ -29,13 +30,13 @@ void set_progname(char **argv); void elog(int pri, int errno_value, const char *fmt, va_list ap); -void fatal(int errno_value, const char *msg, ...) attribute((noreturn)) +void disorder_fatal(int errno_value, const char *msg, ...) attribute((noreturn)) attribute((format (printf, 2, 3))); -void error(int errno_value, const char *msg, ...) +void disorder_error(int errno_value, const char *msg, ...) attribute((format (printf, 2, 3))); -void info(const char *msg, ...) +void disorder_info(const char *msg, ...) attribute((format (printf, 1, 2))); -void debug(const char *msg, ...) +void disorder_debug(const char *msg, ...) attribute((format (printf, 1, 2))); /* report a message of the given class. @errno_value@ if present an * non-zero is included. @fatal@ terminates the process. */ @@ -54,12 +55,18 @@ extern struct log_output log_stderr, log_syslog, *log_default; extern const char *debug_filename; extern int debug_lineno; +extern int logdate; +/** @brief Issue a debug message if debugging is turned on + * @param x Parenthesized debug arguments + * + * Use in the format: D(("format string", arg, arg, ...)); + */ #define D(x) do { \ if(debugging) { \ debug_filename=__FILE__; \ debug_lineno=__LINE__; \ - debug x; \ + disorder_debug x; \ } \ } while(0)