~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

Re-org'd the replication stuff into slots.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
   errmsg_printf()
23
23
*/
24
24
 
25
 
#include "config.h"
26
 
 
27
 
#include <drizzled/definitions.h>
 
25
#include <drizzled/server_includes.h>
 
26
#include <drizzled/plugin/registry.h>
28
27
#include <drizzled/errmsg_print.h>
29
 
#include <drizzled/plugin/error_message.h>
30
 
 
31
 
#include <cerrno>
32
 
#include <cstring>
33
 
 
34
 
namespace drizzled
35
 
{
 
28
#include <drizzled/current_session.h>
 
29
 
 
30
// need this for stderr
 
31
#include <string.h>
 
32
 
 
33
using namespace drizzled;
36
34
 
37
35
void sql_perror(const char *message)
38
36
{
39
 
  char errmsg[STRERROR_MAX];
40
 
  strerror_r(errno, errmsg, sizeof(errmsg));
41
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
 
37
  // is stderr threadsafe?
 
38
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
42
39
}
43
40
 
44
41
bool errmsg_printf (int priority, char const *format, ...)
45
42
{
 
43
  plugin::Registry &plugins= plugin::Registry::singleton();
46
44
  bool rv;
47
45
  va_list args;
48
46
  va_start(args, format);
49
 
  rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
 
47
  rv= plugins.error_message.vprintf(current_session, priority, format, args);
50
48
  va_end(args);
51
49
  return rv;
52
50
}
53
 
 
54
 
} /* namespace drizzled */