CBasicLogConfigurator.h 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * CBasicLogConfigurator.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "CLogger.h"
  12. class CConsoleHandler;
  13. /**
  14. * The basic log configurator reads log properties from settings.json and
  15. * sets up the logging system.
  16. */
  17. class DLL_LINKAGE CBasicLogConfigurator
  18. {
  19. public:
  20. /**
  21. * Constructor.
  22. *
  23. * @param filePath The file path of the log file.
  24. * @param console The console handler to log messages to the console. The handler should be initialized.
  25. *
  26. * @throws std::runtime_error if the configuration has errors
  27. */
  28. CBasicLogConfigurator(const std::string & filePath, CConsoleHandler * console);
  29. private:
  30. // Methods
  31. ELogLevel::ELogLevel getLogLevel(const std::string & level) const;
  32. EConsoleTextColor::EConsoleTextColor getConsoleColor(const std::string & colorName) const;
  33. };