#include "ConsoleServer.h"
#include "ConsoleSession.h"
#include "Command.h"
#include "Log.h"

namespace core {

   ConsoleServer::ConsoleServer(EPoll &ePoll, IPAddress address) : TCPServer(ePoll, address, " ", 10, "Console Server") {
      coreutils::Log(this);
   }

   void ConsoleServer::logSend(std::string out) {
      for(auto *session : sessions)
        ((ConsoleSession *)session)->writeLog(out);
   }

   TCPSession * ConsoleServer::getSocketAccept(EPoll &ePoll) {
      return new ConsoleSession(ePoll, *this);
   }

}
