summaryrefslogtreecommitdiff
path: root/project2/common/logger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/common/logger.cpp')
-rw-r--r--project2/common/logger.cpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/project2/common/logger.cpp b/project2/common/logger.cpp
index b43efa8..2c17dbf 100644
--- a/project2/common/logger.cpp
+++ b/project2/common/logger.cpp
@@ -2,12 +2,8 @@
#define SYSLOG_NAMES 1 // Enables the definition of names in syslog.h
#include "logger.h"
-#include "loggers.h"
-#include <stdio.h>
#include <boost/foreach.hpp>
-#include <boost/algorithm/string/case_conv.hpp>
-const char * const version = "$Id: logger.cpp 8818 2011-01-10 10:09:59Z danielg $";
Log Logger::log;
@@ -96,88 +92,3 @@ LogDriverBase::~LogDriverBase()
{
}
-// File based log driver
-//----------------------
-FileBasedLogDriver::FileBasedLogDriver(FILE * f, int l, bool ts) :
- LogDriverBase(l),
- file(f),
- timestamp(ts)
-{
-}
-FileBasedLogDriver::~FileBasedLogDriver()
-{
-}
-void
-FileBasedLogDriver::message(int priority, const char * msg) const
-{
- if (priority <= level) {
- writeTimestamp();
- writeLevel(priority);
- fprintf(file, "%s\n", msg);
- fflush(file);
- }
-}
-const char *
-FileBasedLogDriver::timeStr() const
-{
- struct tm tm;
- time_t t = time(NULL);
- localtime_r(&t, &tm);
- strftime(tmbuf, sizeof(tmbuf), "%F %T", &tm);
- return tmbuf;
-}
-void
-FileBasedLogDriver::writeTimestamp() const
-{
- if (timestamp) {
- fprintf(file, "%s ", timeStr());
- }
-}
-void
-FileBasedLogDriver::writeLevel(int level) const
-{
- if (timestamp) {
- fprintf(file, "%-6.*s", 5, boost::algorithm::to_upper_copy(std::string(Log::priorityName(level))).c_str());
- }
-}
-
-// Consol driver
-//-------------------
-ConsoleLogDriver::ConsoleLogDriver(FILE * f, int l, bool ts) :
- FileBasedLogDriver(f, l, ts)
-{
-}
-ConsoleLogDriver::~ConsoleLogDriver()
-{
-}
-
-// File log driver
-//-------------------
-FileLogDriver::FileLogDriver(const char * path, int l) :
- FileBasedLogDriver(fopen(path, "a"), l, true)
-{
-}
-FileLogDriver::~FileLogDriver()
-{
- fclose(file);
-}
-
-// Syslog Log Driver
-//-------------------
-SyslogLogDriver::SyslogLogDriver(const char * ident, int level, int option, int facility) :
- LogDriverBase(level)
-{
- openlog(ident, option, facility);
-}
-SyslogLogDriver::~SyslogLogDriver()
-{
- closelog();
-}
-void
-SyslogLogDriver::message(int priority, const char * msg) const
-{
- if (priority <= level) {
- syslog(priority, "%s", msg);
- }
-}
-