Logger.cpp 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // Created by wrede on 12.05.16.
  3. //
  4. #include <iostream>
  5. #include "Logger.h"
  6. namespace util
  7. {
  8. Logger::Logger() : debug_(false), info_(false)
  9. {
  10. /* EMPTY */
  11. }
  12. void Logger::LogInfo(const std::string& message)
  13. {
  14. if (Instance().info_)
  15. {
  16. std::cout << "[Info] " << message << std::endl;
  17. }
  18. }
  19. void Logger::LogError(const std::string& message)
  20. {
  21. std::cout << "[Error] " << message << std::endl;
  22. }
  23. void Logger::LogDebug(const std::string& message)
  24. {
  25. if (Instance().debug_)
  26. {
  27. std::cout << "[Debug] " << message << std::endl;
  28. }
  29. }
  30. void Logger::SetDebug(bool debug)
  31. {
  32. Instance().debug_ = debug;
  33. }
  34. void Logger::SetInfo(bool info)
  35. {
  36. Instance().info_ = info;
  37. }
  38. bool Logger::IsDebugEnabled()
  39. {
  40. return Instance().debug_;
  41. }
  42. bool Logger::IsInfoEnabled()
  43. {
  44. return Instance().info_;
  45. }
  46. }