Logger.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*******************************************************************************
  2. The content of this file includes portions of the AUDIOKINETIC Wwise Technology
  3. released in source code form as part of the SDK installer package.
  4. Commercial License Usage
  5. Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
  6. may use this file in accordance with the end user license agreement provided
  7. with the software or, alternatively, in accordance with the terms contained in a
  8. written agreement between you and Audiokinetic Inc.
  9. Copyright (c) 2023 Audiokinetic Inc.
  10. *******************************************************************************/
  11. #pragma once
  12. #include <string>
  13. namespace AK
  14. {
  15. namespace WwiseAuthoringAPI
  16. {
  17. class Logger
  18. {
  19. public:
  20. typedef void(*LoggerFunction)(const char* logger);
  21. Logger()
  22. : m_callback(nullptr)
  23. {
  24. }
  25. void SetLoggerFunction(LoggerFunction callback)
  26. {
  27. m_callback = callback;
  28. }
  29. void LogMessage(const char* origin, const char* message)
  30. {
  31. if (m_callback != nullptr)
  32. {
  33. std::string result = origin;
  34. result += ": ";
  35. result += message;
  36. m_callback(result.c_str());
  37. }
  38. }
  39. static Logger* Get()
  40. {
  41. return &m_instance;
  42. }
  43. private:
  44. static Logger m_instance;
  45. LoggerFunction m_callback;
  46. };
  47. }
  48. }