diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-05 23:44:56 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-07 18:03:03 +0800 |
| commit | c37bd3e34f5840773949bb55848cda3af6688d20 (patch) | |
| tree | 1d31ea7c3cf8811ea294da9c094027a9e805dfcb /src/session.hpp | |
| parent | aa21e4ea0687fd0c8d333161f5ec31a580512e9e (diff) | |
refactor: logging system
Diffstat (limited to 'src/session.hpp')
| -rw-r--r-- | src/session.hpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/session.hpp b/src/session.hpp index 9dc3f0f..0c5e4f9 100644 --- a/src/session.hpp +++ b/src/session.hpp @@ -1,6 +1,7 @@ #pragma once #include "FileDescriptor.hpp" +#include "format.hpp" #include <string> class CSession { @@ -15,9 +16,11 @@ class CSession { std::string getName() const; bool isValid() const; SRecvData read(); - SRecvData read(std::string &msg); - bool write(const std::string &msg) const; - void run(); + SRecvData read(const std::string &msg); + bool write(const std::string &msg, eFormatType type) const; + template <typename... Args> + bool write(eFormatType type, std::format_string<Args...> fmt, Args &&...args) const; + void run(); private: enum eEventType { @@ -31,6 +34,7 @@ class CSession { void onConnect() const; void onDisconnect() const; void onErrno(eEventType) const; - void onRecv(SRecvData &data) const; + void onRecv(const SRecvData &data) const; + void onSend(const std::string &msg) const; friend class CSessionManager; }; |
