Drizzled Public API Documentation

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  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are
00009  * met:
00010  *
00011  *     * Redistributions of source code must retain the above copyright
00012  * notice, this list of conditions and the following disclaimer.
00013  *
00014  *     * Redistributions in binary form must reproduce the above
00015  * copyright notice, this list of conditions and the following disclaimer
00016  * in the documentation and/or other materials provided with the
00017  * distribution.
00018  *
00019  *     * The names of its contributors may not be used to endorse or
00020  * promote products derived from this software without specific prior
00021  * written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00026  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00027  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00028  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00029  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00030  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00031  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  */
00036 
00042 #ifndef __DRIZZLE_LOCAL_H
00043 #define __DRIZZLE_LOCAL_H
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00063 DRIZZLE_LOCAL
00064 void drizzle_set_error(drizzle_st *drizzle, const char *function,
00065                        const char *format, ...);
00066 
00076 DRIZZLE_LOCAL
00077 void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
00078                  const char *format, va_list args);
00079 
00083 static inline void drizzle_log_fatal(drizzle_st *drizzle, const char *format,
00084                                      ...)
00085 {
00086   va_list args;
00087 
00088   if (drizzle->verbose >= DRIZZLE_VERBOSE_FATAL)
00089   {
00090     va_start(args, format);
00091     drizzle_log(drizzle, DRIZZLE_VERBOSE_FATAL, format, args);
00092     va_end(args);
00093   }
00094 }
00095 
00099 static inline void drizzle_log_error(drizzle_st *drizzle, const char *format,
00100                                      ...)
00101 {
00102   va_list args;
00103 
00104   if (drizzle->verbose >= DRIZZLE_VERBOSE_ERROR)
00105   {
00106     va_start(args, format);
00107     drizzle_log(drizzle, DRIZZLE_VERBOSE_ERROR, format, args);
00108     va_end(args);
00109   }
00110 }
00111 
00115 static inline void drizzle_log_info(drizzle_st *drizzle, const char *format,
00116                                     ...)
00117 {
00118   va_list args;
00119 
00120   if (drizzle->verbose >= DRIZZLE_VERBOSE_INFO)
00121   {
00122     va_start(args, format);
00123     drizzle_log(drizzle, DRIZZLE_VERBOSE_INFO, format, args);
00124     va_end(args);
00125   }
00126 }
00127 
00131 static inline void drizzle_log_debug(drizzle_st *drizzle, const char *format,
00132                                      ...)
00133 {
00134   va_list args;
00135 
00136   if (drizzle->verbose >= DRIZZLE_VERBOSE_DEBUG)
00137   {
00138     va_start(args, format);
00139     drizzle_log(drizzle, DRIZZLE_VERBOSE_DEBUG, format, args);
00140     va_end(args);
00141   }
00142 }
00143 
00147 static inline void drizzle_log_crazy(drizzle_st *drizzle, const char *format,
00148                                      ...)
00149 {
00150   va_list args;
00151 
00152   if (drizzle->verbose >= DRIZZLE_VERBOSE_CRAZY)
00153   {
00154     va_start(args, format);
00155     drizzle_log(drizzle, DRIZZLE_VERBOSE_CRAZY, format, args);
00156     va_end(args);
00157   }
00158 }
00159 
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165 
00166 #endif /* __DRIZZLE_LOCAL_H */