|
37 | 37 | #include <iostream> |
38 | 38 | #include <iomanip> |
39 | 39 | #include <sstream> |
| 40 | +#include <future> |
40 | 41 |
|
41 | 42 | // the modulename is needed for the logger streams (streamDebug, streamInfo, streamWarning, streamError, streamCritical, streamFatal) |
42 | 43 | #define MODULENAME "helloworld_server" |
@@ -182,13 +183,16 @@ int main() |
182 | 183 | EntityServer entityServer; |
183 | 184 | entityContainer.registerEntity(&entityServer, "MyService"); |
184 | 185 |
|
185 | | - SessionInfo sessionLog = entityContainer.connect("tcp://localhost:9200:headersize:protobuf"); |
186 | | - PeerId peerIdLog = entityServer.connect(sessionLog, "LoggingServer", [](PeerId peerId, Status status) { |
187 | | - streamInfo << "Logging Server connect reply: " << status.toString(); |
188 | | - }); |
189 | | - Logger::instance().registerConsumer([&entityServer, peerIdLog](const LogContext& context, const char* text) { |
190 | | - entityServer.sendEvent(peerIdLog, "log", LogEntry(currentISO8601TimeUTC(), "HelloWorldServer", context, text)); |
191 | | - }); |
| 186 | + // SessionInfo sessionLog = entityContainer.connect("tcp://localhost:9200:headersize:protobuf"); |
| 187 | + // PeerId peerIdLog = entityServer.connect(sessionLog, "LoggingServer", [](PeerId peerId, Status status) { |
| 188 | + // streamInfo << "Logging Server connect reply: " << status.toString(); |
| 189 | + // }); |
| 190 | + // ExecutorWorker<Executor> executorLogging(1); |
| 191 | + // Logger::instance().registerConsumer([&executorLogging, &entityServer, peerIdLog](const LogContext& context, const char* text) { |
| 192 | + // executorLogging.addAction([&entityServer, peerIdLog, context, text = std::string(text)]() { |
| 193 | + // entityServer.sendEvent(peerIdLog, "log", LogEntry(currentISO8601TimeUTC(), "HelloWorldServer", context, text.c_str())); |
| 194 | + // }); |
| 195 | + // }); |
192 | 196 |
|
193 | 197 | // register an entity for file download. The name "*" means that if an entity name, given by a client, is not found by name, |
194 | 198 | // then this entity will try to open a file inside the htdocs directory. An entity name can contain slashes ('/') |
|
0 commit comments