libdrizzle Developer Documentation

drizzle_local.h
Go to the documentation of this file.
1 /*
2  * Drizzle Client & Protocol Library
3  *
4  * Copyright (C) 2008 Eric Day (eday@oddments.org)
5  * All rights reserved.
6  *
7  * Use and distribution licensed under the BSD license. See
8  * the COPYING file in this directory for full text.
9  */
10 
16 #ifndef __DRIZZLE_LOCAL_H
17 #define __DRIZZLE_LOCAL_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
38 void drizzle_set_error(drizzle_st *drizzle, const char *function,
39  const char *format, ...);
40 
51 void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
52  const char *format, va_list args);
53 
57 static inline void drizzle_log_fatal(drizzle_st *drizzle, const char *format,
58  ...)
59 {
60  va_list args;
61 
62  if (drizzle->verbose >= DRIZZLE_VERBOSE_FATAL)
63  {
64  va_start(args, format);
65  drizzle_log(drizzle, DRIZZLE_VERBOSE_FATAL, format, args);
66  va_end(args);
67  }
68 }
69 
73 static inline void drizzle_log_error(drizzle_st *drizzle, const char *format,
74  ...)
75 {
76  va_list args;
77 
78  if (drizzle->verbose >= DRIZZLE_VERBOSE_ERROR)
79  {
80  va_start(args, format);
81  drizzle_log(drizzle, DRIZZLE_VERBOSE_ERROR, format, args);
82  va_end(args);
83  }
84 }
85 
89 static inline void drizzle_log_info(drizzle_st *drizzle, const char *format,
90  ...)
91 {
92  va_list args;
93 
94  if (drizzle->verbose >= DRIZZLE_VERBOSE_INFO)
95  {
96  va_start(args, format);
97  drizzle_log(drizzle, DRIZZLE_VERBOSE_INFO, format, args);
98  va_end(args);
99  }
100 }
101 
105 static inline void drizzle_log_debug(drizzle_st *drizzle, const char *format,
106  ...)
107 {
108  va_list args;
109 
110  if (drizzle->verbose >= DRIZZLE_VERBOSE_DEBUG)
111  {
112  va_start(args, format);
113  drizzle_log(drizzle, DRIZZLE_VERBOSE_DEBUG, format, args);
114  va_end(args);
115  }
116 }
117 
121 static inline void drizzle_log_crazy(drizzle_st *drizzle, const char *format,
122  ...)
123 {
124  va_list args;
125 
126  if (drizzle->verbose >= DRIZZLE_VERBOSE_CRAZY)
127  {
128  va_start(args, format);
129  drizzle_log(drizzle, DRIZZLE_VERBOSE_CRAZY, format, args);
130  va_end(args);
131  }
132 }
133 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* __DRIZZLE_LOCAL_H */