Logger.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #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 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 _log(const ls_std::byte *_data, const ls_std::LogLevel &_logLevel);
  36. };
  37. }
  38. #endif