LogLevel.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2020-08-20
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #ifndef LS_STD_LOG_LEVEL_HPP
  11. #define LS_STD_LOG_LEVEL_HPP
  12. #include "LogLevelValue.hpp"
  13. #include <ls-std/core/Class.hpp>
  14. #include <ls-std/os/dynamic-goal.hpp>
  15. #include <string_view>
  16. #include <unordered_map>
  17. /*
  18. * @doc: class(name: 'LogLevel', package: 'io')
  19. * @doc: io.LogLevel.description('This class represents the log level controlling how noisy a log should be.')
  20. * */
  21. namespace ls::standard::io
  22. {
  23. class LS_STD_DYNAMIC_GOAL LogLevel : public ls::standard::core::Class
  24. {
  25. public:
  26. explicit LogLevel(const ls::standard::io::LogLevelValue &_value);
  27. LogLevel();
  28. ~LogLevel() noexcept override;
  29. ls::standard::io::LogLevel &operator=(const ls::standard::io::LogLevelValue &_value);
  30. bool operator<(const ls::standard::io::LogLevelValue &_value) const;
  31. bool operator<=(const ls::standard::io::LogLevelValue &_value) const;
  32. bool operator>(const ls::standard::io::LogLevelValue &_value) const;
  33. bool operator>=(const ls::standard::io::LogLevelValue &_value) const;
  34. bool operator==(const ls::standard::io::LogLevelValue &_value) const;
  35. [[nodiscard]] ls::standard::io::LogLevelValue getValue() const;
  36. void setLogLevel(const ls::standard::io::LogLevelValue &_value);
  37. void setLogLevel(const ::std::string &_value);
  38. [[nodiscard]] ::std::string toString() const;
  39. private:
  40. ::std::unordered_map<ls::standard::io::LogLevelValue, ::std::string> level{};
  41. ls::standard::io::LogLevelValue value{};
  42. [[nodiscard]] ls::standard::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  43. void _init();
  44. [[nodiscard]] bool _isValidLogLevelString(::std::string_view _value) const;
  45. };
  46. }
  47. #endif