diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-05 14:53:25 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-05 14:53:25 +0000 |
commit | 24b02dc831889986211600a75572737e733ef9d8 (patch) | |
tree | 50e1525e5749c8b6e51969d8ff88060a172b0497 /plugins/imfile/imfile.c | |
parent | 213e0b596205626214891fb46e1a780af7f26a8b (diff) | |
download | rsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.gz rsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.xz rsyslog-24b02dc831889986211600a75572737e733ef9d8.zip |
- extracted logerror*() family of functions from syslogd, made them their
own class and converted to new object calling conventions
(interface-based)
- converted gss-misc into a loadable library module
Diffstat (limited to 'plugins/imfile/imfile.c')
-rw-r--r-- | plugins/imfile/imfile.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index ef452bc5..aa866a6d 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -39,6 +39,7 @@ #include "srUtils.h" /* some utility functions */ #include "msg.h" #include "stream.h" +#include "errmsg.h" MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ @@ -46,6 +47,7 @@ MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ /* Module static data */ DEF_IMOD_STATIC_DATA /* must be present, starts static data */ +DEFobjCurrIf(errmsg) typedef struct fileInfo_s { uchar *pszFileName; @@ -278,7 +280,7 @@ ENDrunInput BEGINwillRun CODESTARTwillRun if(iFilPtr == 0) { - logerror("No files configured to be monitored"); + errmsg.LogError(NO_ERRCODE, "No files configured to be monitored"); ABORT_FINALIZE(RS_RET_NO_RUN); } @@ -398,21 +400,21 @@ static rsRetVal addMonitor(void __attribute__((unused)) *pVal, uchar __attribute pThis = &files[iFilPtr]; /* TODO: check for strdup() NULL return */ if(pszFileName == NULL) { - logerror("imfile error: no file name given, file monitor can not be created"); + errmsg.LogError(NO_ERRCODE, "imfile error: no file name given, file monitor can not be created"); ABORT_FINALIZE(RS_RET_CONFIG_ERROR); } else { pThis->pszFileName = (uchar*) strdup((char*) pszFileName); } if(pszFileTag == NULL) { - logerror("imfile error: no tag value given , file monitor can not be created"); + errmsg.LogError(NO_ERRCODE, "imfile error: no tag value given , file monitor can not be created"); ABORT_FINALIZE(RS_RET_CONFIG_ERROR); } else { pThis->pszTag = (uchar*) strdup((char*) pszFileTag); } if(pszStateFile == NULL) { - logerror("imfile error: not state file name given, file monitor can not be created"); + errmsg.LogError(NO_ERRCODE, "imfile error: not state file name given, file monitor can not be created"); ABORT_FINALIZE(RS_RET_CONFIG_ERROR); } else { pThis->pszStateFile = (uchar*) strdup((char*) pszStateFile); @@ -421,7 +423,7 @@ static rsRetVal addMonitor(void __attribute__((unused)) *pVal, uchar __attribute pThis->iSeverity = iSeverity; pThis->iFacility = iFacility; } else { - logerror("Too many file monitors configured - ignoring this one"); + errmsg.LogError(NO_ERRCODE, "Too many file monitors configured - ignoring this one"); ABORT_FINALIZE(RS_RET_OUT_OF_DESRIPTORS); } @@ -447,6 +449,7 @@ BEGINmodInit() CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr + CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilename", 0, eCmdHdlrGetWord, NULL, &pszFileName, STD_LOADABLE_MODULE_ID)); |