diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-28 15:41:35 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-28 15:41:35 +0100 |
commit | 3562802cacc8dbd0c155146acfdb8d04c6440009 (patch) | |
tree | f2139c64c6713d1c59df4b8601c11fca52fa62f5 /frontend/print.h | |
parent | a070c649ddbe70a22f6265b9f5b48f6bde7eac08 (diff) |
implement transcript-style log
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; +}; + |