~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/drizzle_local.h

  • Committer: Monty Taylor
  • Date: 2008-08-02 00:06:32 UTC
  • mto: (236.1.42 codestyle)
  • mto: This revision was merged to the branch mainline in revision 261.
  • Revision ID: monty@inaugust.com-20080802000632-jsse0zdd9r6ic5ku
Actually turn gettext on...

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
11
 
/**
12
 
 * @file
13
 
 * @brief Local Drizzle Declarations
14
 
 */
15
 
 
16
 
#ifndef __DRIZZLE_LOCAL_H
17
 
#define __DRIZZLE_LOCAL_H
18
 
 
19
 
#ifdef __cplusplus
20
 
extern "C" {
21
 
#endif
22
 
 
23
 
/**
24
 
 * @addtogroup drizzle_local Local Drizzle Declarations
25
 
 * @ingroup drizzle
26
 
 * @{
27
 
 */
28
 
 
29
 
/**
30
 
 * Set the error string.
31
 
 *
32
 
 * @param[in] drizzle Drizzle structure previously initialized with
33
 
 *  drizzle_create() or drizzle_clone().
34
 
 * @param[in] function Name of function the error happened in. 
35
 
 * @param[in] format Format and variable argument list of message.
36
 
 */
37
 
DRIZZLE_LOCAL
38
 
void drizzle_set_error(drizzle_st *drizzle, const char *function,
39
 
                       const char *format, ...);
40
 
 
41
 
/**
42
 
 * Log a message.
43
 
 *
44
 
 * @param[in] drizzle Drizzle structure previously initialized with
45
 
 *  drizzle_create() or drizzle_clone().
46
 
 * @param[in] verbose Logging level of the message.
47
 
 * @param[in] format Format and variable argument list of message.
48
 
 * @param[in] args Variable argument list that has been initialized.
49
 
 */
50
 
DRIZZLE_LOCAL
51
 
void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
52
 
                 const char *format, va_list args);
53
 
 
54
 
/**
55
 
 * Log a fatal message, see drizzle_log() for argument details.
56
 
 */
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
 
 
70
 
/**
71
 
 * Log an error message, see drizzle_log() for argument details.
72
 
 */
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
 
 
86
 
/**
87
 
 * Log an info message, see drizzle_log() for argument details.
88
 
 */
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
 
 
102
 
/**
103
 
 * Log a debug message, see drizzle_log() for argument details.
104
 
 */
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
 
 
118
 
/**
119
 
 * Log a crazy message, see drizzle_log() for argument details.
120
 
 */
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
 
 
134
 
/** @} */
135
 
 
136
 
#ifdef __cplusplus
137
 
}
138
 
#endif
139
 
 
140
 
#endif /* __DRIZZLE_LOCAL_H */