4 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU Lesser General Public License v.2.1.
10 * You should have received a copy of the GNU Lesser General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 #ifndef __CLUSTER_LOG_LOGGING_DOT_H__
16 #define __CLUSTER_LOG_LOGGING_DOT_H__
21 /* SHORT_UUID - print last 8 chars of a string */
22 #define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x)
24 extern char *__rq_types_off_by_one
[];
25 #define RQ_TYPE(x) __rq_types_off_by_one[(x) - 1]
27 extern int log_tabbing
;
28 extern int log_is_open
;
29 extern int log_membership_change
;
30 extern int log_checkpoint
;
31 extern int log_resend_requests
;
33 #define LOG_OPEN(ident, option, facility) do { \
34 openlog(ident, option, facility); \
38 #define LOG_CLOSE(void) do { \
43 #define LOG_OUTPUT(level, f, arg...) do { \
46 FILE *fp = (level > LOG_NOTICE) ? stderr : stdout; \
48 for (__i = 0; (__i < log_tabbing) && (__i < 15); __i++) \
49 __buffer[__i] = '\t'; \
50 __buffer[__i] = '\0'; \
51 syslog(level, "%s" f "\n", __buffer, ## arg); \
53 for (__i = 0; __i < log_tabbing; __i++) \
55 fprintf(fp, f "\n", ## arg); \
61 #define LOG_DBG(f, arg...) LOG_OUTPUT(LOG_DEBUG, f, ## arg)
63 #define LOG_DBG(f, arg...)
66 #define LOG_COND(__X, f, arg...) do {\
68 LOG_OUTPUT(LOG_NOTICE, f, ## arg); \
71 #define LOG_PRINT(f, arg...) LOG_OUTPUT(LOG_NOTICE, f, ## arg)
72 #define LOG_ERROR(f, arg...) LOG_OUTPUT(LOG_ERR, f, ## arg)
74 #endif /* __CLUSTER_LOG_LOGGING_DOT_H__ */