1
/* Gearman server and library
2
* Copyright (C) 2008 Brian Aker, Eric Day
5
* Use and distribution licensed under the BSD license. See
6
* the COPYING file in the parent directory for full text.
11
* @brief Error definitions
20
void gearman_error_set(gearman_st *gearman, const char *function,
21
const char *format, ...)
25
char log_buffer[GEARMAN_MAX_ERROR_SIZE];
28
va_start(arg, format);
30
length= strlen(function);
32
/* Copy the function name and : before the format */
33
ptr= memcpy(log_buffer, function, length);
38
length= (size_t)vsnprintf(ptr, GEARMAN_MAX_ERROR_SIZE - length - 1, format,
41
if (gearman->log_fn == NULL)
42
memcpy(gearman->last_error, log_buffer, length);
45
(*(gearman->log_fn))(log_buffer, GEARMAN_VERBOSE_FATAL,
46
(void *)(gearman)->log_context);