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 
00037 #pragma once
00038 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00062 DRIZZLE_LOCAL
00063 void drizzle_set_error(drizzle_st *drizzle, const char *function,
00064                        const char *format, ...);
00065 
00075 DRIZZLE_LOCAL
00076 void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
00077                  const char *format, va_list args);
00078 
00082 static inline void drizzle_log_fatal(drizzle_st *drizzle, const char *format,
00083                                      ...)
00084 {
00085   va_list args;
00086 
00087   if (drizzle->verbose >= DRIZZLE_VERBOSE_FATAL)
00088   {
00089     va_start(args, format);
00090     drizzle_log(drizzle, DRIZZLE_VERBOSE_FATAL, format, args);
00091     va_end(args);
00092   }
00093 }
00094 
00098 static inline void drizzle_log_error(drizzle_st *drizzle, const char *format,
00099                                      ...)
00100 {
00101   va_list args;
00102 
00103   if (drizzle->verbose >= DRIZZLE_VERBOSE_ERROR)
00104   {
00105     va_start(args, format);
00106     drizzle_log(drizzle, DRIZZLE_VERBOSE_ERROR, format, args);
00107     va_end(args);
00108   }
00109 }
00110 
00114 static inline void drizzle_log_info(drizzle_st *drizzle, const char *format,
00115                                     ...)
00116 {
00117   va_list args;
00118 
00119   if (drizzle->verbose >= DRIZZLE_VERBOSE_INFO)
00120   {
00121     va_start(args, format);
00122     drizzle_log(drizzle, DRIZZLE_VERBOSE_INFO, format, args);
00123     va_end(args);
00124   }
00125 }
00126 
00130 static inline void drizzle_log_debug(drizzle_st *drizzle, const char *format,
00131                                      ...)
00132 {
00133   va_list args;
00134 
00135   if (drizzle->verbose >= DRIZZLE_VERBOSE_DEBUG)
00136   {
00137     va_start(args, format);
00138     drizzle_log(drizzle, DRIZZLE_VERBOSE_DEBUG, format, args);
00139     va_end(args);
00140   }
00141 }
00142 
00146 static inline void drizzle_log_crazy(drizzle_st *drizzle, const char *format,
00147                                      ...)
00148 {
00149   va_list args;
00150 
00151   if (drizzle->verbose >= DRIZZLE_VERBOSE_CRAZY)
00152   {
00153     va_start(args, format);
00154     drizzle_log(drizzle, DRIZZLE_VERBOSE_CRAZY, format, args);
00155     va_end(args);
00156   }
00157 }
00158 
00161 #ifdef __cplusplus
00162 }
00163 #endif