Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CArchLogUnix.cpp

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

Generated on Fri Nov 6 00:21:13 2009 for synergy-plus by  doxygen 1.3.9.1