All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoggerTool.cpp
Go to the documentation of this file.
1 /*
2  * LoggerTool.cpp
3  *
4  * This file is part of the HausmiSEP project
5  *
6  * Copyright (C) 2012, 2013 Marco Alvarado (malvcr@gmail.com)
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <HSEP/LoggerTool.h>
23 
24 #include <syslog.h>
25 
26 namespace HSEP {
27 
28  void LoggerTool::send(LogType pLogType, string& pDataRef) {
29 
30  switch (pLogType) {
31  case LT_SYSTEMINFO :
32  syslog(LOG_INFO,pDataRef.c_str());
33  break;
34  case LT_SYSTEMERROR :
35  syslog(LOG_ERR,pDataRef.c_str());
36  break;
37  default:
38  break;
39  }
40 
41  } // LoggerTool::send
42 
43  void LoggerTool::send(LogType pLogType,const char* pDataPtr) {
44 
45  switch (pLogType) {
46  case LT_SYSTEMINFO :
47  syslog(LOG_INFO,pDataPtr);
48  break;
49  case LT_SYSTEMERROR :
50  syslog(LOG_ERR,pDataPtr);
51  break;
52  default:
53  break;
54  }
55 
56  } // LoggerTool::send
57 
58 } // HSEP namespace
59