LogLevel.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #include <ls_std/io/logging/LogLevel.hpp>
  10. ls_std::LogLevel::LogLevel(const ls_std::LogLevelValue &_value)
  11. : ls_std::Class("LogLevel"),
  12. value(_value)
  13. {
  14. this->_init();
  15. }
  16. ls_std::LogLevel::LogLevel() : Class("LogLevel")
  17. {}
  18. ls_std::LogLevel::operator unsigned char() const
  19. {
  20. return this->value;
  21. }
  22. ls_std::LogLevel &ls_std::LogLevel::operator=(const ls_std::LogLevelValue &_value)
  23. {
  24. this->value = _value;
  25. return *this;
  26. }
  27. bool ls_std::LogLevel::operator<=(const ls_std::LogLevelValue &_value)
  28. {
  29. return this->value <= _value;
  30. }
  31. std::string ls_std::LogLevel::toString() const
  32. {
  33. return this->level.at(this->value);
  34. }
  35. void ls_std::LogLevel::_init()
  36. {
  37. this->level.insert({ls_std::LogLevelValue::FATAL, "FATAL"});
  38. this->level.insert({ls_std::LogLevelValue::ERR, "ERROR"});
  39. this->level.insert({ls_std::LogLevelValue::WARN, "WARN"});
  40. this->level.insert({ls_std::LogLevelValue::INFO, "INFO"});
  41. this->level.insert({ls_std::LogLevelValue::DEBUG, "DEBUG"});
  42. this->level.insert({ls_std::LogLevelValue::TRACE, "TRACE"});
  43. this->level.insert({ls_std::LogLevelValue::OFF, "OFF"});
  44. }