Commit 45ec1d9b authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#106 cta-taped logging a timestamp

As agreed by Eric and Steve, the "<priority | LOG_LOCAL3>" prefix
of non-syslog error messages has been dropped.
parent 4f1ff4b5
......@@ -78,7 +78,7 @@ void Logger::operator() (
// Safe to get a reference to the textual representation of the priority
const std::string &priorityText = priorityTextPair->second;
const std::string header = createMsgHeader(priority | LOG_LOCAL3, timeStamp, m_programName, pid);
const std::string header = createMsgHeader(timeStamp, m_programName, pid);
const std::string body = createMsgBody(priority, priorityText, msg, params, rawParams, m_programName, pid);
writeMsgToUnderlyingLoggingSystem(header, body);
......@@ -227,7 +227,6 @@ void Logger::setLogMask(const int logMask) {
// createMsgHeader
std::string Logger::createMsgHeader(
const int priority,
const struct timeval &timeStamp,
const std::string &programName,
const int pid) {
......@@ -236,8 +235,6 @@ std::string Logger::createMsgHeader(
int bufLen = sizeof(buf);
int len = 0;
os << "<" << priority << ">";
struct tm localTime;
localtime_r(&(timeStamp.tv_sec), &localTime);
len += strftime(buf, bufLen, "%Y-%m-%dT%T", &localTime);
......@@ -246,14 +246,12 @@ private:
* relies on rsyslog to provide message headers and therefore does not call
* this method.
* @param priority The priority of the message.
* @param timeStamp The time stamp of the message.
* @param programName the program name of the log message.
* @param pid The process ID of the process logging the message.
* @return The message header.
static std::string createMsgHeader(
const int priority,
const struct timeval &timeStamp,
const std::string &programName,
const int pid);
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