ctkFileLogger.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkFileLogger_h
  15. #define __ctkFileLogger_h
  16. // Qt includes
  17. #include <QObject>
  18. // CTK includes
  19. #include "ctkCoreExport.h"
  20. //------------------------------------------------------------------------------
  21. class ctkFileLoggerPrivate;
  22. //------------------------------------------------------------------------------
  23. /// \ingroup Core
  24. class CTK_CORE_EXPORT ctkFileLogger : public QObject
  25. {
  26. Q_OBJECT
  27. Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
  28. Q_PROPERTY(QString filePath READ filePath WRITE setFilePath)
  29. public:
  30. typedef QObject Superclass;
  31. typedef ctkFileLogger Self;
  32. explicit ctkFileLogger(QObject* parentObject = 0);
  33. virtual ~ctkFileLogger();
  34. bool enabled()const;
  35. void setEnabled(bool value);
  36. QString filePath()const;
  37. void setFilePath(const QString& filePath);
  38. int numberOfFilesToKeep()const;
  39. void setNumberOfFilesToKeep(int value);
  40. public Q_SLOTS:
  41. void logMessage(const QString& msg);
  42. protected:
  43. QScopedPointer<ctkFileLoggerPrivate> d_ptr;
  44. private:
  45. Q_DECLARE_PRIVATE(ctkFileLogger);
  46. Q_DISABLE_COPY(ctkFileLogger);
  47. };
  48. #endif