simplelayout.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /******************************************************************************
  2. *
  3. * package: Log4Qt
  4. * file: simplelayout.cpp
  5. * created: September 2007
  6. * author: Martin Heinrich
  7. *
  8. *
  9. * Copyright 2007 Martin Heinrich
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. *
  23. ******************************************************************************/
  24. /******************************************************************************
  25. * Dependencies
  26. ******************************************************************************/
  27. #include "log4qt/simplelayout.h"
  28. #include <QtCore/QDebug>
  29. #include "log4qt/loggingevent.h"
  30. namespace Log4Qt
  31. {
  32. /**************************************************************************
  33. * Declarations
  34. **************************************************************************/
  35. /**************************************************************************
  36. * C helper functions
  37. **************************************************************************/
  38. /**************************************************************************
  39. * Class implementation: SimpleLayout
  40. **************************************************************************/
  41. QString SimpleLayout::format(const LoggingEvent &rEvent)
  42. {
  43. return rEvent.level().toString() + QLatin1String(" - ") + rEvent.message() + Layout::endOfLine();
  44. }
  45. #ifndef QT_NO_DEBUG_STREAM
  46. QDebug SimpleLayout::debug(QDebug &rDebug) const
  47. {
  48. rDebug.nospace() << "SimpleLayout("
  49. << "name:" << name() << " "
  50. << "referencecount:" << referenceCount()
  51. << ")";
  52. return rDebug.space();
  53. }
  54. #endif // QT_NO_DEBUG_STREAM
  55. /**************************************************************************
  56. * Implementation: Operators, Helper
  57. **************************************************************************/
  58. } // namespace Log4Qt