- Timestamp:
- Oct 25, 2009 8:46:40 AM (15 years ago)
- Location:
- pjproject/trunk/pjlib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/errno.h
r2506 r2965 111 111 PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode, 112 112 char *buf, pj_size_t bufsize); 113 114 /** 115 * Print the error message pertaining to the specified error code to 116 * the log. 117 * 118 * @param log_level The log will be printed at this log level. 119 * @param sender The log sender string. 120 * @param status The error code which error message will be printed. 121 * @param title String to be printed before the error message. Note 122 * that a colon will be added automatically between 123 * this string and the error message. 124 * @param options Options, currently must be zero. 125 */ 126 #if PJ_LOG_MAX_LEVEL >= 1 127 PJ_DECL(void) pj_perror(int log_level, const char *sender, 128 pj_status_t status, const char *title, 129 int options); 130 #else 131 # define pj_perror(level, sender, status, title, options) 132 #endif /* #if PJ_LOG_MAX_LEVEL >= 1 */ 133 113 134 114 135 /** -
pjproject/trunk/pjlib/src/pj/errno.c
r2394 r2965 19 19 */ 20 20 #include <pj/errno.h> 21 #include <pj/log.h> 21 22 #include <pj/string.h> 22 23 #include <pj/compat/string.h> 24 #include <pj/compat/stdarg.h> 23 25 #include <pj/assert.h> 24 26 … … 197 199 } 198 200 201 #if PJ_LOG_MAX_LEVEL >= 1 202 static void call_logger(const char *sender, int level, const char *format, ...) 203 { 204 va_list arg; 205 va_start(arg, format); 206 pj_log(sender, level, format, arg); 207 va_end(arg); 208 } 209 210 /* 211 * perror() 212 */ 213 PJ_DEF(void) pj_perror(int log_level, const char *sender, 214 pj_status_t status, const char *title, 215 int options) 216 { 217 char errmsg[PJ_ERR_MSG_SIZE]; 218 219 PJ_ASSERT_ON_FAIL(options==0, return); 220 PJ_UNUSED_ARG(options); 221 222 pj_strerror(status, errmsg, sizeof(errmsg)); 223 call_logger(sender, log_level, "%s: %s", title, errmsg); 224 } 225 #endif /* #if PJ_LOG_MAX_LEVEL >= 1 */ 226 227
Note: See TracChangeset
for help on using the changeset viewer.