/* Copyright 2014 ROBLOX Corporation, All Rights Reserved */ #pragma once #include "V8Tree/Instance.h" #include "V8Tree/Service.h" #include namespace RBX { namespace Network { class Player; } extern const char *const sLogService; class LogService : public DescribedCreatable , public Service { public: LogService(); void requestServerOutput(); void executeScript(std::string source); shared_ptr getLogHistory(); rbx::signal outputMessageSignal; rbx::remote_signal)> requestServerOutputSignal; rbx::remote_signal serverOutputMessageSignal; rbx::remote_signal, std::string)> requestScriptExecutionSignal; /*override*/ void processRemoteEvent(const Reflection::EventDescriptor& descriptor, const Reflection::EventArguments& args, const SystemAddress& source); void runCallbackIfPlayerHasConsoleAccess(shared_ptr player, boost::function callback); static int filterSensitiveKeys(std::string& text); protected: virtual void onServiceProvider(ServiceProvider* oldSp, ServiceProvider* newSp); private: void onMessageOut(const StandardOutMessage& message); static void doFireEvent(StandardOutMessage message, weak_ptr logService); static void handleCanManageResponse(boost::function callback, weak_ptr weakLogService, std::string* responseString, std::exception* exception); static void maybeConnectPlayerToServerLogs(weak_ptr weakLogService, shared_ptr instance); static void connectPlayerToServerLogs(weak_ptr weakLogService, weak_ptr weakPlayer); void maybeExecuteServerScript(shared_ptr requestingPlayer, std::string source); static void executeServerScript(weak_ptr weakLogService, std::string source); bool currentlyFiringEvent; rbx::signals::scoped_connection messageOutConnection; boost::circular_buffer_space_optimized logHistory; rbx::signals::scoped_connection listenForServerLogRequestConnection; weak_ptr playerReceivingServerLogs; std::list > playersReceivingServerLogs; }; }