00001 00007 #pragma once 00008 00009 #include "Tools/Message.hpp" 00010 #include "Tools/LogListener.hpp" 00011 00012 namespace Tool { 00013 00016 class LogManager { 00017 private: 00018 static LogManager *instance; 00019 00020 std::deque<LogCommand> history; 00021 std::deque<LogListener*> listeners; 00022 00023 bool enabled; 00024 00025 LogManager(); 00026 00027 public: 00028 static LogManager &getInstance(); 00029 00035 bool attachLogListener(LogListener *listener, const bool &history=true); 00040 bool detachLogListener(LogListener *listener); 00041 00046 bool isAttached(LogListener *listener) const; 00047 00049 void clear(); 00050 00054 const std::deque<LogCommand> &getHistory() const; 00055 00056 void startSubSection(const std::string &message); 00057 void finishSubSection(const std::string &message); 00058 00059 void startProgress(const std::string &message); 00060 void finishProgess(const bool success = true); 00061 00062 void send(const Message &message); 00063 void send(const LogCommand &cmd); 00064 00065 void setEnabled(const bool &enable); 00066 const bool &isEnabled() const; 00067 }; 00068 00069 }