Logger.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2021-07-16
  7. *
  8. * */
  9. #ifndef LS_STD_LOGGER_HPP
  10. #define LS_STD_LOGGER_HPP
  11. #include <ls_std/base/Class.hpp>
  12. #include "LogLevel.hpp"
  13. #include <ls_std/io/IWriter.hpp>
  14. #include <ls_std/io/File.hpp>
  15. #include <ls_std/io/FileOutputStream.hpp>
  16. #include <string>
  17. namespace ls_std
  18. {
  19. class Logger : public ls_std::Class
  20. {
  21. public:
  22. explicit Logger(const std::shared_ptr<ls_std::IWriter> &_writer);
  23. ~Logger() override = default;
  24. void debug(const ls_std::byte *_data);
  25. void error(const ls_std::byte *_data);
  26. void fatal(const ls_std::byte *_data);
  27. ls_std::LogLevel getLogLevel();
  28. void info(const ls_std::byte *_data);
  29. void setLogLevel(const ls_std::LogLevelValue &_logLevelValue);
  30. void trace(const ls_std::byte *_data);
  31. void warn(const ls_std::byte *_data);
  32. private:
  33. ls_std::LogLevel logLevel{};
  34. std::shared_ptr<ls_std::IWriter> writer{};
  35. void _assignWriter(const std::shared_ptr<ls_std::IWriter> &_writer);
  36. void _log(const ls_std::byte *_data, const ls_std::LogLevel &_logLevel);
  37. };
  38. }
  39. #endif