summaryrefslogtreecommitdiffstats
path: root/plugins/ommysql
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-06 09:44:16 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-06 09:44:16 +0000
commit15e8b33eedce5985701f0b8c949125999fcf789b (patch)
treef44a9af22478c5f8a31a347fb5b13b1ab47f8828 /plugins/ommysql
parent680e899ce9bf84b2406620f4dc1a35986568c97a (diff)
downloadrsyslog-15e8b33eedce5985701f0b8c949125999fcf789b.tar.gz
rsyslog-15e8b33eedce5985701f0b8c949125999fcf789b.tar.xz
rsyslog-15e8b33eedce5985701f0b8c949125999fcf789b.zip
fixed a few remaining logerror() calls - thanks to Michael Biebl for
pointing that out
Diffstat (limited to 'plugins/ommysql')
-rw-r--r--plugins/ommysql/ommysql.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index e9c0b043..5876b754 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -43,12 +43,14 @@
#include "template.h"
#include "ommysql.h"
#include "module-template.h"
+#include "errmsg.h"
MODULE_TYPE_OUTPUT
/* internal structures
*/
DEF_OMOD_STATIC_DATA
+DEFobjCurrIf(errmsg)
typedef struct _instanceData {
MYSQL *f_hmysql; /* handle to MySQL */
@@ -118,7 +120,7 @@ static void reportDBError(instanceData *pData, int bSilent)
/* output log message */
errno = 0;
if(pData->f_hmysql == NULL) {
- logerror("unknown DB error occured - could not obtain MySQL handle");
+ errmsg.LogError(NO_ERRCODE, "unknown DB error occured - could not obtain MySQL handle");
} else { /* we can ask mysql for the error description... */
uMySQLErrno = mysql_errno(pData->f_hmysql);
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", uMySQLErrno,
@@ -127,7 +129,7 @@ static void reportDBError(instanceData *pData, int bSilent)
dbgprintf("mysql, DBError(silent): %s\n", errMsg);
else {
pData->uLastMySQLErrno = uMySQLErrno;
- logerror(errMsg);
+ errmsg.LogError(NO_ERRCODE, "%s", errMsg);
}
}
@@ -148,7 +150,7 @@ static rsRetVal initMySQL(instanceData *pData, int bSilent)
pData->f_hmysql = mysql_init(NULL);
if(pData->f_hmysql == NULL) {
- logerror("can not initialize MySQL handle");
+ errmsg.LogError(NO_ERRCODE, "can not initialize MySQL handle");
iRet = RS_RET_SUSPENDED;
} else { /* we could get the handle, now on with work... */
/* Connect to database */
@@ -273,7 +275,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* Retries make no sense.
*/
if (iMySQLPropErr) {
- logerror("Trouble with MySQL connection properties. -MySQL logging disabled");
+ errmsg.LogError(NO_ERRCODE, "Trouble with MySQL connection properties. -MySQL logging disabled");
ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
} else {
pData->f_hmysql = NULL; /* initialize, but connect only on first message (important for queued mode!) */
@@ -298,6 +300,7 @@ BEGINmodInit()
CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
ENDmodInit
/*
* vi:set ai: