Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

SyslogTarget.hh

Go to the documentation of this file.
00001 // $Id: SyslogTarget.hh 1772 2011-03-10 12:45:21Z tho $
00002 //
00003 // Copyright (C) 2008
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Utils_Logger_SyslogTarget_
00027 #define HH_SENF_Utils_Logger_SyslogTarget_ 1
00028 
00029 // Custom includes
00030 #include <syslog.h>
00031 #include <boost/shared_ptr.hpp>
00032 #include "Target.hh"
00033 
00034 //#include "SyslogTarget.mpp"
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 
00037 namespace senf {
00038 
00039     namespace console { class DirectoryNode; }
00040 
00041 namespace log {
00042 
00077     class SyslogTarget
00078         : public Target
00079     {
00080     public:
00081         //-////////////////////////////////////////////////////////////////////////
00083         //\{
00084 
00085         explicit SyslogTarget(int facility = LOG_USER);
00086 
00087         //\}
00088         //-////////////////////////////////////////////////////////////////////////
00089 
00090     private:
00091         void v_write(time_type timestamp, std::string const & stream,
00092                      std::string const & area, unsigned level,
00093                      std::string const & message);
00094 
00095         int facility_;
00096 
00097     public:
00098         static int const LEVELMAP[8];
00099 
00100         enum LogFacility {
00101             AUTHPRIV = LOG_AUTHPRIV,
00102             CRON = LOG_CRON,
00103             DAEMON = LOG_DAEMON,
00104             FTP = LOG_FTP,
00105             KERN = LOG_KERN,
00106             LOCAL0 = LOG_LOCAL0,
00107             LOCAL1 = LOG_LOCAL1,
00108             LOCAL2 = LOG_LOCAL2,
00109             LOCAL3 = LOG_LOCAL3,
00110             LOCAL4 = LOG_LOCAL4,
00111             LOCAL5 = LOG_LOCAL5,
00112             LOCAL6 = LOG_LOCAL6,
00113             LOCAL7 = LOG_LOCAL7,
00114             LPR = LOG_LPR,
00115             MAIL = LOG_MAIL,
00116             NEWS = LOG_NEWS,
00117             SYSLOG = LOG_SYSLOG,
00118             USER = LOG_USER,
00119             UUCP = LOG_UUCP
00120         };
00121 
00122     private:
00123         struct RegisterConsole {
00124             RegisterConsole();
00125             static boost::shared_ptr<console::DirectoryNode> create(
00126                 LogFacility facility);
00127             static RegisterConsole instance;
00128         };
00129     };
00130 
00131 }}
00132 
00133 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00134 #include "SyslogTarget.cci"
00135 //#include "SyslogTarget.ct"
00136 //#include "SyslogTarget.cti"
00137 #endif
00138 
00139 
00140 // Local Variables:
00141 // mode: c++
00142 // fill-column: 100
00143 // comment-column: 40
00144 // c-file-style: "senf"
00145 // indent-tabs-mode: nil
00146 // ispell-local-dictionary: "american"
00147 // compile-command: "scons -u test"
00148 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research