IdsaAppender.hh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * IdsaAppender.hh
  3. *
  4. * Copyright 2000, Marc Welz
  5. *
  6. * See the COPYING file for the terms of usage and distribution.
  7. */
  8. #ifndef _LOG4CPP_IDSAAPPENDER_HH
  9. #define _LOG4CPP_IDSAAPPENDER_HH
  10. #include <log4cpp/Portability.hh>
  11. #include <string>
  12. #include <stdarg.h>
  13. #include <idsa.h>
  14. #include <log4cpp/AppenderSkeleton.hh>
  15. LOG4CPP_NS_BEGIN
  16. /**
  17. * IdsaAppender is an Appender that sends LoggingEvents to the IDS/A
  18. * logger and reference monitor by Marc Welz.
  19. * See http://jade.cs.uct.ac.za/idsa/ for more information on IDS/A.
  20. **/
  21. class IdsaAppender : public AppenderSkeleton {
  22. public:
  23. /**
  24. * Instantiate an IdsaAppender with given name and name.
  25. * Unlike the syslog API, idsa allows multiple connections.
  26. * @param name The name of the Appender
  27. * @param idsaName The service parameter of idsa
  28. **/
  29. IdsaAppender(const std::string& name, const std::string& idsaName);
  30. virtual ~IdsaAppender();
  31. /**
  32. * Calls idsa_open() and idsa_close()
  33. **/
  34. virtual bool reopen();
  35. /**
  36. * Calls idsa_close()
  37. **/
  38. virtual void close();
  39. /**
  40. * The IdsaAppender does its own Layout.
  41. * @returns false
  42. **/
  43. virtual bool requiresLayout() const;
  44. virtual void setLayout(Layout* layout);
  45. protected:
  46. /**
  47. * Calls idsa_open().
  48. **/
  49. virtual void open();
  50. /**
  51. * Sends a LoggingEvent to idsa.
  52. * @param event the LoggingEvent to log.
  53. **/
  54. virtual void _append(const LoggingEvent& event);
  55. const std::string _idsaName;
  56. IDSA_CONNECTION *_idsaConnection;
  57. };
  58. LOG4CPP_NS_END
  59. #endif // _LOG4CPP_IDSAAPPENDER_HH