BsDebug.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsPrerequisitesUtil.h"
  6. #include "BsLog.h"
  7. namespace BansheeEngine
  8. {
  9. class Log;
  10. /**
  11. * @brief Utility class providing various debug functionality. Thread safe.
  12. */
  13. class BS_UTILITY_EXPORT Debug
  14. {
  15. public:
  16. /**
  17. * @brief Adds a log entry in the "Debug" channel.
  18. */
  19. void logDebug(const String& msg);
  20. /**
  21. * @brief Adds a log entry in the "Info" channel.
  22. */
  23. void logInfo(const String& msg);
  24. /**
  25. * @brief Adds a log entry in the "Warning" channel.
  26. */
  27. void logWarning(const String& msg);
  28. /**
  29. * @brief Adds a log entry in the "Error" channel.
  30. */
  31. void logError(const String& msg);
  32. /**
  33. * @brief Adds a log entry in the specified channel. You may specify custom channels as needed.
  34. */
  35. void log(const String& msg, const String& channel);
  36. /**
  37. * @brief Retrieves the Log used by the Debug instance.
  38. */
  39. Log& getLog() { return mLog; }
  40. /**
  41. * @brief Converts raw pixels into a BMP image. See "BitmapWriter" for more information.
  42. */
  43. void writeAsBMP(UINT8* rawPixels, UINT32 bytesPerPixel, UINT32 width, UINT32 height, const Path& filePath, bool overwrite = true) const;
  44. private:
  45. Log mLog;
  46. };
  47. BS_UTILITY_EXPORT Debug& gDebug();
  48. #define LOGDBG(x) BansheeEngine::gDebug().logDebug((x));
  49. #define LOGINFO(x) BansheeEngine::gDebug().logInfo((x));
  50. #define LOGWRN(x) BansheeEngine::gDebug().logWarning((x));
  51. #define LOGERR(x) BansheeEngine::gDebug().logError((x));
  52. }