libdrizzle Developer Documentation

libdrizzle/drizzle_local.h
Go to the documentation of this file.
00001 /*
00002  * Drizzle Client & Protocol Library
00003  *
00004  * Copyright (C) 2008 Eric Day (eday@oddments.org)
00005  * All rights reserved.
00006  *
00007  * Use and distribution licensed under the BSD license.  See
00008  * the COPYING file in this directory for full text.
00009  */
00010 
00016 #ifndef __DRIZZLE_LOCAL_H
00017 #define __DRIZZLE_LOCAL_H
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00037 DRIZZLE_LOCAL
00038 void drizzle_set_error(drizzle_st *drizzle, const char *function,
00039                        const char *format, ...);
00040 
00050 DRIZZLE_LOCAL
00051 void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
00052                  const char *format, va_list args);
00053 
00057 static inline void drizzle_log_fatal(drizzle_st *drizzle, const char *format,
00058                                      ...)
00059 {
00060   va_list args;
00061 
00062   if (drizzle->verbose >= DRIZZLE_VERBOSE_FATAL)
00063   {
00064     va_start(args, format);
00065     drizzle_log(drizzle, DRIZZLE_VERBOSE_FATAL, format, args);
00066     va_end(args);
00067   }
00068 }
00069 
00073 static inline void drizzle_log_error(drizzle_st *drizzle, const char *format,
00074                                      ...)
00075 {
00076   va_list args;
00077 
00078   if (drizzle->verbose >= DRIZZLE_VERBOSE_ERROR)
00079   {
00080     va_start(args, format);
00081     drizzle_log(drizzle, DRIZZLE_VERBOSE_ERROR, format, args);
00082     va_end(args);
00083   }
00084 }
00085 
00089 static inline void drizzle_log_info(drizzle_st *drizzle, const char *format,
00090                                     ...)
00091 {
00092   va_list args;
00093 
00094   if (drizzle->verbose >= DRIZZLE_VERBOSE_INFO)
00095   {
00096     va_start(args, format);
00097     drizzle_log(drizzle, DRIZZLE_VERBOSE_INFO, format, args);
00098     va_end(args);
00099   }
00100 }
00101 
00105 static inline void drizzle_log_debug(drizzle_st *drizzle, const char *format,
00106                                      ...)
00107 {
00108   va_list args;
00109 
00110   if (drizzle->verbose >= DRIZZLE_VERBOSE_DEBUG)
00111   {
00112     va_start(args, format);
00113     drizzle_log(drizzle, DRIZZLE_VERBOSE_DEBUG, format, args);
00114     va_end(args);
00115   }
00116 }
00117 
00121 static inline void drizzle_log_crazy(drizzle_st *drizzle, const char *format,
00122                                      ...)
00123 {
00124   va_list args;
00125 
00126   if (drizzle->verbose >= DRIZZLE_VERBOSE_CRAZY)
00127   {
00128     va_start(args, format);
00129     drizzle_log(drizzle, DRIZZLE_VERBOSE_CRAZY, format, args);
00130     va_end(args);
00131   }
00132 }
00133 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 #endif /* __DRIZZLE_LOCAL_H */