LogLevel.cpp 1.3 KB

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