Commit 2d21f53b authored by Steven Murray's avatar Steven Murray
Browse files

First complete but not full tested merge of the new logging API into the

CASTOR framework via the class castor::server:BaseServer.

Constructive feedback, and better still modifications, are warmly welcomed.
parent b09a3af3
......@@ -86,26 +86,6 @@ public:
const Param params[],
const struct timeval &timeStamp) throw() = 0;
/**
* A template function that wraps logMsg in order to get the compiler
* to automatically determine the size of the params parameter, therefore
*
* Note that this version of logMsg() allows the caller to specify the
* time stamp of the log message.
*
* @param priority the priority of the message as defined by the syslog API.
* @param msg the message.
* @param params the parameters of the message.
* @param timeStamp the time stamp of the log message.
*/
template<int numParams> void logMsg(
const int priority,
const std::string &msg,
castor::log::Param(&params)[numParams],
const struct timeval &timeStamp) throw() {
logMsg(priority, msg, numParams, params, timeStamp);
}
/**
* Writes a message into the CASTOR logging system. Note that no exception
* will ever be thrown in case of failure. Failures will actually be
......@@ -123,26 +103,7 @@ public:
const int priority,
const std::string &msg,
const int numParams,
const castor::log::Param params[]) throw() = 0;
/**
* A template function that wraps logMsg in order to get the compiler
* to automatically determine the size of the params parameter, therefore
* removing the need for the devloper to provide it explicity.
*
* Note that this version of logMsg() implicitly uses the current time as
* the time stamp of the message.
*
* @param priority the priority of the message as defined by the syslog API.
* @param msg the message.
* @param params the parameters of the message.
*/
template<int numParams> void logMsg(
const int priority,
const std::string &msg,
castor::log::Param(&params)[numParams]) throw() {
logMsg(priority, msg, numParams, params);
}
const Param params[]) throw() = 0;
/**
* Writes a message into the CASTOR logging system. Note that no exception
......
......@@ -240,7 +240,7 @@ void castor::log::LoggerImplementation::logMsg(
const int priority,
const std::string &msg,
const int numParams,
const castor::log::Param params[],
const log::Param params[],
const struct timeval &timeStamp) throw() {
//---------------------------------------------------------------------------
// Note that we do here part of the work of the real syslog call, by building
......@@ -487,7 +487,7 @@ void castor::log::LoggerImplementation::logMsg(
const int priority,
const std::string &msg,
const int numParams,
const castor::log::Param params[]) throw() {
const log::Param params[]) throw() {
struct timeval timeStamp;
gettimeofday(&timeStamp, NULL);
......
......@@ -94,7 +94,7 @@ public:
const int priority,
const std::string &msg,
const int numParams,
const castor::log::Param params[]) throw();
const Param params[]) throw();
/**
* Writes a message into the CASTOR logging system. Note that no exception
......
......@@ -227,3 +227,35 @@ void castor::server::BaseServer::sendNotification
// this is a best effort service, ignore any failure
}
}
//-----------------------------------------------------------------------------
// logMsg
//-----------------------------------------------------------------------------
void castor::server::BaseServer::logMsg(
const int priority,
const std::string &msg,
const int numParams,
const log::Param params[],
const struct timeval &timeStamp) throw() {
m_logger.logMsg(priority, msg, numParams, params, timeStamp);
}
//-----------------------------------------------------------------------------
// logMsg
//-----------------------------------------------------------------------------
void castor::server::BaseServer::logMsg(
const int priority,
const std::string &msg,
const int numParams,
const log::Param params[]) throw() {
m_logger.logMsg(priority, msg, numParams, params);
}
//-----------------------------------------------------------------------------
// logMsg
//-----------------------------------------------------------------------------
void castor::server::BaseServer::logMsg(
const int priority,
const std::string &msg) throw() {
m_logger.logMsg(priority, msg);
}
......@@ -141,6 +141,105 @@ namespace castor {
*/
virtual void help(std::string) {};
/**
* Writes a message into the CASTOR logging system. Note that no exception
* will ever be thrown in case of failure. Failures will actually be
* silently ignored in order to not impact the processing.
*
* Note that this version of logMsg() allows the caller to specify the
* time stamp of the log message.
*
* @param priority the priority of the message as defined by the syslog
* API.
* @param msg the message.
* @param numParams the number of parameters in the message.
* @param params the parameters of the message.
* @param timeStamp the time stamp of the log message.
*/
void logMsg(
const int priority,
const std::string &msg,
const int numParams,
const log::Param params[],
const struct timeval &timeStamp) throw();
/**
* A template function that wraps logMsg in order to get the compiler
* to automatically determine the size of the params parameter, therefore
*
* Note that this version of logMsg() allows the caller to specify the
* time stamp of the log message.
*
* @param priority the priority of the message as defined by the syslog
* API.
* @param msg the message.
* @param params the parameters of the message.
* @param timeStamp the time stamp of the log message.
*/
template<int numParams> void logMsg(
const int priority,
const std::string &msg,
castor::log::Param(&params)[numParams],
const struct timeval &timeStamp) throw() {
logMsg(priority, msg, numParams, params, timeStamp);
}
/**
* Writes a message into the CASTOR logging system. Note that no exception
* will ever be thrown in case of failure. Failures will actually be
* silently ignored in order to not impact the processing.
*
* Note that this version of logMsg() implicitly uses the current time as
* the time stamp of the message.
*
* @param priority the priority of the message as defined by the syslog
* API.
* @param msg the message.
* @param numParams the number of parameters in the message.
* @param params the parameters of the message.
*/
void logMsg(
const int priority,
const std::string &msg,
const int numParams,
const castor::log::Param params[]) throw();
/**
* A template function that wraps logMsg in order to get the compiler
* to automatically determine the size of the params parameter, therefore
* removing the need for the devloper to provide it explicity.
*
* Note that this version of logMsg() implicitly uses the current time as
* the time stamp of the message.
*
* @param priority the priority of the message as defined by the syslog
* API.
* @param msg the message.
* @param params the parameters of the message.
*/
template<int numParams> void logMsg(
const int priority,
const std::string &msg,
castor::log::Param(&params)[numParams]) throw() {
logMsg(priority, msg, numParams, params);
}
/**
* Writes a message into the CASTOR logging system. Note that no exception
* will ever be thrown in case of failure. Failures will actually be
* silently ignored in order to not impact the processing.
*
* Note that this version of logMsg() implicitly uses the current time as
* the time stamp of the message.
*
* @param priority the priority of the message as defined by the syslog
* API.
* @param msg the message.
*/
void logMsg(
const int priority,
const std::string &msg) throw();
/**
* Flag indicating whether the server should
* run in foreground or background mode.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment