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: 2020-09-04
  7. *
  8. * */
  9. #ifndef LS_STD_LOGGER_HPP
  10. #define LS_STD_LOGGER_HPP
  11. #include "../../base/Class.hpp"
  12. #include "LogLevel.hpp"
  13. #include "../IWriter.hpp"
  14. #include "../File.hpp"
  15. #include "../FileOutputStream.hpp"
  16. #include <string>
  17. namespace ls_std {
  18. class Logger : public Class {
  19. public:
  20. explicit Logger(const std::string& _path);
  21. ~Logger() = default;
  22. void close();
  23. void debug(const ls_std::byte* _data);
  24. void error(const ls_std::byte* _data);
  25. void fatal(const ls_std::byte* _data);
  26. ls_std::LogLevel getLogLevel();
  27. void info(const ls_std::byte* _data);
  28. void setLogLevel(const ls_std::LogLevelValue& _logLevelValue);
  29. void trace(const ls_std::byte* _data);
  30. void warn(const ls_std::byte* _data);
  31. private:
  32. ls_std::File file;
  33. ls_std::LogLevel logLevel {};
  34. std::shared_ptr<ls_std::FileOutputStream> outputStream {};
  35. void _init();
  36. void _log(const ls_std::byte* _data, const ls_std::LogLevel& _logLevel);
  37. };
  38. }
  39. #endif