23 #include <unordered_map>
27 #include "DebugStream.h"
28 #include "ThreadCreator.h"
29 #include "UTCPSocket.h"
30 #include "CommonEventLoop.h"
31 #include "LogServerTypes.h"
33 #ifndef DISABLE_REST_API
34 #include <Poco/JSON/Object.h>
97 LogServer( std::shared_ptr<DebugStream> log );
98 LogServer( std::shared_ptr<LogAgregator> log );
101 void setCmdTimeout( timeout_t msec ) noexcept;
102 void setSessionLog( Debug::type t ) noexcept;
103 void setMaxSessionCount(
size_t num ) noexcept;
105 bool async_run(
const std::string& addr, Poco::UInt16 port );
106 bool run(
const std::string& addr, Poco::UInt16 port );
110 bool isRunning()
const noexcept;
112 bool check(
bool restart_if_fail =
true );
114 void init(
const std::string& prefix, xmlNode* cnode = 0 );
116 static std::string help_print(
const std::string& prefix );
118 std::string getShortInfo();
120 #ifndef DISABLE_REST_API
121 Poco::JSON::Object::Ptr httpGetShortInfo();
127 virtual void evprepare(
const ev::loop_ref& loop )
override;
128 virtual void evfinish(
const ev::loop_ref& loop )
override;
129 virtual std::string wname()
const noexcept
override;
131 void ioAccept( ev::io& watcher,
int revents );
133 void saveDefaultLogLevels(
const std::string& logname );
134 void restoreDefaultLogLevels(
const std::string& logname );
135 std::string onCommand(
LogSession* s, LogServerTypes::Command cmd,
const std::string& logname );
139 timeout_t cmdTimeout = { 2000 };
140 Debug::type sessLogLevel = { Debug::NONE };
141 size_t sessMaxCount = { 10 };
143 typedef std::vector< std::shared_ptr<LogSession> > SessionList;
153 std::shared_ptr<UTCPSocket> sock;
154 std::shared_ptr<DebugStream> elog;
160 std::unordered_map< DebugStream*, Debug::type > defaultLogLevels;
162 std::string myname = {
"LogServer" };
163 std::string addr = {
"" };
164 Poco::UInt16 port = { 0 };
166 std::atomic_bool isrunning = {
false };
Definition: DebugStream.h:62
The CommonEventLoop class Реализация механизма "один eventloop, много подписчиков" (libev)....
Definition: CommonEventLoop.h:55
Definition: CommonEventLoop.h:19
Definition: LogServer.h:94
Definition: LogSession.h:39
Definition: CommonEventLoop.h:15