24 #include "Poco/Net/StreamSocket.h"
26 #include "DebugStream.h"
28 #include "UTCPStream.h"
29 #include "LogAgregator.h"
30 #ifndef DISABLE_REST_API
31 #include <Poco/JSON/Object.h>
42 LogSession(
const Poco::Net::StreamSocket& s, std::shared_ptr<DebugStream>& log, timeout_t cmdTimeout = 2000, timeout_t checkConnectionTime = 10000 );
45 typedef sigc::slot<void, LogSession*> FinalSlot;
46 void connectFinalSession( FinalSlot sl ) noexcept;
50 typedef sigc::signal<std::string, LogSession*, LogServerTypes::Command, const std::string& > LogSessionCommand_Signal;
51 LogSessionCommand_Signal signal_logsession_command();
54 void cancel() noexcept;
56 inline std::string getClientAddress()
const noexcept
61 inline void setSessionLogLevel( Debug::type t ) noexcept
65 inline void addSessionLogLevel( Debug::type t ) noexcept
69 inline void delSessionLogLevel( Debug::type t ) noexcept
76 size_t getMaxBufSize()
const noexcept;
79 void run(
const ev::loop_ref& loop ) noexcept;
82 bool isAcive()
const noexcept;
84 std::string name()
const noexcept;
86 std::string getShortInfo() noexcept;
88 #ifndef DISABLE_REST_API
89 Poco::JSON::Object::Ptr httpGetShortInfo();
95 void event( ev::async& watcher,
int revents ) noexcept;
96 void callback( ev::io& watcher,
int revents ) noexcept;
97 void readEvent( ev::io& watcher ) noexcept;
98 void writeEvent( ev::io& watcher );
99 size_t readData(
unsigned char* buf,
int len );
101 void onCmdTimeout( ev::timer& watcher,
int revents ) noexcept;
102 void onCheckConnectionTimer( ev::timer& watcher,
int revents ) noexcept;
103 void final() noexcept;
105 void logOnEvent(
const std::string& s ) noexcept;
107 timeout_t cmdTimeout = { 2000 };
108 float checkConnectionTime = { 10. };
117 size_t maxRecordsNum = { 30000 };
120 std::queue<UTCPCore::Buffer*> logbuf;
121 std::mutex logbuf_mutex;
122 bool lostMsg = {
false };
125 size_t maxCount = { 0 };
126 size_t minSizeMsg = { 0 };
127 size_t maxSizeMsg = { 0 };
128 size_t numLostMsg = { 0 };
130 std::string peername = {
"" };
131 std::string caddr = {
"" };
132 std::shared_ptr<DebugStream> log;
133 std::shared_ptr<LogAgregator> alog;
134 sigc::connection conn;
136 std::shared_ptr<UTCPStream> sock;
140 ev::async asyncEvent;
141 ev::timer checkConnectionTimer;
144 std::atomic_bool cancelled = {
false };
146 LogSessionCommand_Signal m_command_sig;
153 #endif // LogSession_H_
Definition: DebugStream.h:91
Definition: CallbackTimer.h:29
void setMaxBufSize(size_t num)
Установить размер буфера для сообщений (количество записей. Не в байтах!!)
Definition: LogSession.cc:642
void addLevel(Debug::type t) noexcept
Adds t to the current debug level.
Definition: DebugStream.h:120
void delLevel(Debug::type t) noexcept
Deletes t from the current debug level.
Definition: DebugStream.h:126
Definition: LogServerTypes.h:52
void level(Debug::type t) noexcept
Sets the debug level to t.
Definition: DebugStream.h:108
Definition: LogSession.h:38