You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
719 B

2 months ago
  1. /**
  2. * @file logging.h
  3. *
  4. * Implementation of general logging functionality
  5. */
  6. #pragma once
  7. #include <ostream>
  8. namespace l3pp {
  9. /**
  10. * Streaming operator for LogLevel.
  11. * @param os Output stream.
  12. * @param level LogLevel.
  13. * @return os.
  14. */
  15. inline std::ostream& operator<<(std::ostream& os, LogLevel level) {
  16. switch (level) {
  17. case LogLevel::TRACE: return os << "TRACE";
  18. case LogLevel::DEBUG: return os << "DEBUG";
  19. case LogLevel::INFO: return os << "INFO";
  20. case LogLevel::WARN: return os << "WARN";
  21. case LogLevel::ERR: return os << "ERROR";
  22. case LogLevel::FATAL: return os << "FATAL";
  23. case LogLevel::OFF: return os << "OFF";
  24. default: return os << "???";
  25. }
  26. }
  27. }