You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.8 KiB

  1. // -*- C++ -*-
  2. // Module: Log4cplus
  3. // File: clfsappender.h
  4. // Created: 5/2012
  5. // Author: Vaclav Zeman
  6. //
  7. //
  8. // Copyright (C) 2012-2013, Vaclav Zeman. All rights reserved.
  9. //
  10. // Redistribution and use in source and binary forms, with or without modifica-
  11. // tion, are permitted provided that the following conditions are met:
  12. //
  13. // 1. Redistributions of source code must retain the above copyright notice,
  14. // this list of conditions and the following disclaimer.
  15. //
  16. // 2. Redistributions in binary form must reproduce the above copyright notice,
  17. // this list of conditions and the following disclaimer in the documentation
  18. // and/or other materials provided with the distribution.
  19. //
  20. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  21. // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  22. // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  25. // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  27. // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. //
  31. /** @file */
  32. #ifndef LOG4CPLUS_CLFSAPPENDER_H
  33. #define LOG4CPLUS_CLFSAPPENDER_H
  34. #include <log4cplus/config.hxx>
  35. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  36. #pragma once
  37. #endif
  38. #include <log4cplus/appender.h>
  39. #if defined (LOG4CPLUS_CLFSAPPENDER_BUILD_DLL)
  40. # if defined (INSIDE_LOG4CPLUS_CLFSAPPENDER)
  41. # define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllexport)
  42. # else
  43. # define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllimport)
  44. # endif
  45. #else
  46. # define LOG4CPLUS_CLFSAPPENDER_EXPORT
  47. #endif
  48. namespace log4cplus
  49. {
  50. class LOG4CPLUS_CLFSAPPENDER_EXPORT CLFSAppender
  51. : public Appender
  52. {
  53. public:
  54. CLFSAppender (tstring const & logname, unsigned long logsize,
  55. unsigned long buffersize);
  56. explicit CLFSAppender (helpers::Properties const &);
  57. virtual ~CLFSAppender ();
  58. virtual void close ();
  59. static void registerAppender ();
  60. protected:
  61. virtual void append (spi::InternalLoggingEvent const &);
  62. void init (tstring const & logname, unsigned long logsize,
  63. unsigned long buffersize);
  64. struct Data;
  65. Data * data;
  66. private:
  67. CLFSAppender (CLFSAppender const &);
  68. CLFSAppender & operator = (CLFSAppender const &);
  69. };
  70. typedef helpers::SharedObjectPtr<CLFSAppender> CLFSAppenderPtr;
  71. } // namespace log4cplus
  72. #endif // LOG4CPLUS_CLFSAPPENDER_H