ctkLogger.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 __ctkLogger_h
  15. #define __ctkLogger_h
  16. // Qt includes
  17. #include <QObject>
  18. // CTK includes
  19. #include <ctkPimpl.h>
  20. #include "ctkCoreExport.h"
  21. class ctkLoggerPrivate;
  22. /// \ingroup Core
  23. class CTK_CORE_EXPORT ctkLogger : public QObject
  24. {
  25. Q_OBJECT
  26. public:
  27. typedef QObject Superclass;
  28. /// Default mode is Off
  29. explicit ctkLogger(QString name, QObject* parent = 0);
  30. virtual ~ctkLogger ();
  31. static void configure();
  32. void debug(const QString& s);
  33. void info(const QString& s);
  34. void trace(const QString& s);
  35. void warn(const QString& s);
  36. void error(const QString& s);
  37. void fatal(const QString& s);
  38. void setOff();
  39. void setDebug();
  40. void setInfo();
  41. void setTrace();
  42. void setError();
  43. void setWarn();
  44. void setFatal();
  45. bool isOffEnabled();
  46. bool isDebugEnabled();
  47. bool isInfoEnabled();
  48. bool isTraceEnabled();
  49. bool isWarnEnabled();
  50. bool isErrorEnabled();
  51. bool isFatalEnabled();
  52. protected:
  53. QScopedPointer<ctkLoggerPrivate> d_ptr;
  54. private:
  55. Q_DECLARE_PRIVATE(ctkLogger);
  56. Q_DISABLE_COPY(ctkLogger);
  57. };
  58. #endif