1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#include <drizzled/server_includes.h>
21
#include <drizzled/replication/reporting.h>
22
#include <drizzled/gettext.h>
23
#include <drizzled/errmsg_print.h>
26
Slave_reporting_capability::report(loglevel level, int err_code,
27
const char *msg, ...) const
29
char buff[MAX_SLAVE_ERRMSG];
31
uint32_t pbuffsize= sizeof(buff);
36
it must be reported in Last_error and Last_errno in
40
if (level == ERROR_LEVEL)
42
pbuff= m_last_error.message;
43
pbuffsize= sizeof(m_last_error.message);
44
m_last_error.number= err_code;
48
vsnprintf(pbuff, pbuffsize, msg, args);
51
/* If the msg string ends with '.', do not add a ',' it would be ugly */
52
/* todo: check type loglevel against errmsg priority */
53
errmsg_printf((int) level,
54
_("Slave %s: %s%s Error_code: %d"),
56
(pbuff[0] && *(strchr(pbuff, '\0')-1) == '.') ? "" : ",",