Win32DebugAppender.hh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Win32DebugAppender.hh
  3. *
  4. *
  5. * See the COPYING file for the terms of usage and distribution.
  6. */
  7. #ifndef _LOG4CPP_WIN32DEBUGAPPENDER_HH
  8. #define _LOG4CPP_WIN32DEBUGAPPENDER_HH
  9. #ifdef _WIN32 // only use this on Win32
  10. #include <string>
  11. #include "log4cpp/Export.hh"
  12. #include "log4cpp/LayoutAppender.hh"
  13. LOG4CPP_NS_BEGIN
  14. /**
  15. * Win32DebugAppender simply sends the log message to the default system
  16. * debugger on Win32 systems. This is useful for users of MSVC and Borland
  17. * because the log messages will show up in the debugger window.<BR>
  18. * <B>NB:</B> This class is only available on Win32 platforms.
  19. */
  20. class LOG4CPP_EXPORT Win32DebugAppender : public LayoutAppender {
  21. public:
  22. /**
  23. * Constructor.
  24. * @param name Name used by the base classes only.
  25. */
  26. Win32DebugAppender(const std::string& name);
  27. /**
  28. * Destructor.
  29. */
  30. virtual ~Win32DebugAppender();
  31. /**
  32. * Close method. This is called by the framework, but there is nothing
  33. * to do for the OutputDebugString API, so it simply returns.
  34. */
  35. virtual void close();
  36. protected:
  37. /**
  38. * Method that does the actual work. In this case, it simply sets up the layout
  39. * and calls the OutputDebugString API.
  40. * @param event Event for which we are logging.
  41. */
  42. virtual void _append(const LoggingEvent& event);
  43. private:
  44. // suppress assignment operator
  45. Win32DebugAppender & operator=(const Win32DebugAppender &);
  46. };
  47. LOG4CPP_NS_END
  48. #else // WIN32
  49. #error NTEventLoggAppender is not available on on Win32 platforms
  50. #endif // WIN32
  51. #endif // _LOG4CPP_WIN32DEBUGAPPENDER_HH