doc
|
00001 /* 00002 * libcsync -- a library to sync a directory with another 00003 * 00004 * Copyright (c) 2006-2012 by Andreas Schneider <asn@cryptomilk.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 /** 00022 * @file csync_log.h 00023 * 00024 * @brief Logging interface of csync 00025 * 00026 * @defgroup csyncLogInternals csync logging internals 00027 * @ingroup csyncInternalAPI 00028 * 00029 * @{ 00030 */ 00031 00032 #ifndef _CSYNC_LOG_H 00033 #define _CSYNC_LOG_H 00034 00035 /* GCC have printf type attribute check. */ 00036 #ifndef PRINTF_ATTRIBUTE 00037 #ifdef __GNUC__ 00038 #ifdef _WIN32 00039 #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__gnu_printf__, a, b))) 00040 #else 00041 #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) 00042 #endif 00043 #else 00044 #define PRINTF_ATTRIBUTE(a,b) 00045 #endif /* __GNUC__ */ 00046 #endif /* ndef PRINTF_ATTRIBUTE */ 00047 00048 enum csync_log_priority_e { 00049 CSYNC_LOG_PRIORITY_NOLOG = 0, 00050 CSYNC_LOG_PRIORITY_FATAL, 00051 CSYNC_LOG_PRIORITY_ALERT, 00052 CSYNC_LOG_PRIORITY_CRIT, 00053 CSYNC_LOG_PRIORITY_ERROR, 00054 CSYNC_LOG_PRIORITY_WARN, 00055 CSYNC_LOG_PRIORITY_NOTICE, 00056 CSYNC_LOG_PRIORITY_INFO, 00057 CSYNC_LOG_PRIORITY_DEBUG, 00058 CSYNC_LOG_PRIORITY_TRACE, 00059 CSYNC_LOG_PRIORITY_NOTSET, 00060 CSYNC_LOG_PRIORITY_UNKNOWN, 00061 }; 00062 00063 #define CSYNC_LOG(priority, ...) \ 00064 csync_log(ctx, priority, __FUNCTION__, __VA_ARGS__) 00065 00066 void csync_log(CSYNC *ctx, 00067 int verbosity, 00068 const char *function, 00069 const char *format, ...) PRINTF_ATTRIBUTE(4, 5); 00070 00071 /** 00072 * }@ 00073 */ 00074 #endif /* _CSYNC_LOG_H */ 00075 00076 /* vim: set ft=c.doxygen ts=4 sw=4 et cindent: */