| Line |  | 
|---|
| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2002 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 5 | * This package is free software; you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the GNU General Public License | 
|---|
| 7 | * found in the file COPYING that should have accompanied this file. | 
|---|
| 8 | * | 
|---|
| 9 | * This package is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #include "CArchLogUnix.h" | 
|---|
| 16 | #include <syslog.h> | 
|---|
| 17 |  | 
|---|
| 18 | // | 
|---|
| 19 | // CArchLogUnix | 
|---|
| 20 | // | 
|---|
| 21 |  | 
|---|
| 22 | CArchLogUnix::CArchLogUnix() | 
|---|
| 23 | { | 
|---|
| 24 | // do nothing | 
|---|
| 25 | } | 
|---|
| 26 |  | 
|---|
| 27 | CArchLogUnix::~CArchLogUnix() | 
|---|
| 28 | { | 
|---|
| 29 | // do nothing | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | void | 
|---|
| 33 | CArchLogUnix::openLog(const char* name) | 
|---|
| 34 | { | 
|---|
| 35 | openlog(name, 0, LOG_DAEMON); | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | void | 
|---|
| 39 | CArchLogUnix::closeLog() | 
|---|
| 40 | { | 
|---|
| 41 | closelog(); | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 | void | 
|---|
| 45 | CArchLogUnix::showLog(bool) | 
|---|
| 46 | { | 
|---|
| 47 | // do nothing | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | void | 
|---|
| 51 | CArchLogUnix::writeLog(ELevel level, const char* msg) | 
|---|
| 52 | { | 
|---|
| 53 | // convert level | 
|---|
| 54 | int priority; | 
|---|
| 55 | switch (level) { | 
|---|
| 56 | case kERROR: | 
|---|
| 57 | priority = LOG_ERR; | 
|---|
| 58 | break; | 
|---|
| 59 |  | 
|---|
| 60 | case kWARNING: | 
|---|
| 61 | priority = LOG_WARNING; | 
|---|
| 62 | break; | 
|---|
| 63 |  | 
|---|
| 64 | case kNOTE: | 
|---|
| 65 | priority = LOG_NOTICE; | 
|---|
| 66 | break; | 
|---|
| 67 |  | 
|---|
| 68 | case kINFO: | 
|---|
| 69 | priority = LOG_INFO; | 
|---|
| 70 | break; | 
|---|
| 71 |  | 
|---|
| 72 | default: | 
|---|
| 73 | priority = LOG_DEBUG; | 
|---|
| 74 | break; | 
|---|
| 75 | } | 
|---|
| 76 |  | 
|---|
| 77 | // log it | 
|---|
| 78 | syslog(priority, "%s", msg); | 
|---|
| 79 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.