• Main Page
  • Classes
  • Files
  • File List

CArchLogUnix.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "CArchLogUnix.h"
00020 #include <syslog.h>
00021 
00022 //
00023 // CArchLogUnix
00024 //
00025 
00026 CArchLogUnix::CArchLogUnix()
00027 {
00028     // do nothing
00029 }
00030 
00031 CArchLogUnix::~CArchLogUnix()
00032 {
00033     // do nothing
00034 }
00035 
00036 void
00037 CArchLogUnix::openLog(const char* name)
00038 {
00039     openlog(name, 0, LOG_DAEMON);
00040 }
00041 
00042 void
00043 CArchLogUnix::closeLog()
00044 {
00045     closelog();
00046 }
00047 
00048 void
00049 CArchLogUnix::showLog(bool)
00050 {
00051     // do nothing
00052 }
00053 
00054 void
00055 CArchLogUnix::writeLog(ELevel level, const char* msg)
00056 {
00057     // convert level
00058     int priority;
00059     switch (level) {
00060     case kERROR:
00061         priority = LOG_ERR;
00062         break;
00063 
00064     case kWARNING:
00065         priority = LOG_WARNING;
00066         break;
00067 
00068     case kNOTE:
00069         priority = LOG_NOTICE;
00070         break;
00071 
00072     case kINFO:
00073         priority = LOG_INFO;
00074         break;
00075 
00076     default:
00077         priority = LOG_DEBUG;
00078         break;
00079     }
00080 
00081     // log it
00082     syslog(priority, "%s", msg);
00083 }

Generated on Sun May 19 2013 00:00:04 for Synergy by  doxygen 1.7.1