diff options
Diffstat (limited to 'frontend/print.h')
-rw-r--r-- | frontend/print.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/frontend/print.h b/frontend/print.h new file mode 100644 index 0000000..6b526ae --- /dev/null +++ b/frontend/print.h @@ -0,0 +1,27 @@ +#pragma once + +#include <cstring> +#include <memory> +#include <functional> +#include <string> + +void lprtf(const char * fmt, ...); + +class SessionLog { +public: + static SessionLog & get(); + +private: + SessionLog(); + virtual ~SessionLog() = default; + +public: + virtual void append(const std::string & str); + virtual void append(const char * str); + virtual void append(const char * buf, size_t buf_size); + +private: + std::unique_ptr<FILE, std::function<void(FILE*)>> file = nullptr; + static constexpr bool enable = true; +}; + |