45 enum LogType { LogError, LogWarning, LogInfo,
46 LogDebug, LogVerbose };
53 RFLog(
const std::string& source, LogType def_type = LogInfo);
57 void SetSource(
const std::string& source);
59 friend void SetLogPrint(
bool print);
60 friend void SetLogPrint(LogType type,
bool print);
61 friend void SetLogStream(std::ostream* ostr);
62 friend void SetLogColor(
bool color);
63 friend void SetLogMaxWidth(
int NMAX);
67 RFLog& operator<< (LogType type);
69 RFLog& operator<< (std::ostream& (*_f)(std::ostream&));
70 RFLog& operator<< (std::ios& (*_f)(std::ios&));
73 RFLog& operator<< (T arg){
79 static std::ostream* m_Ostr;
82 static std::map<LogType, bool> m_PrintMap;
83 std::map<LogType, std::string> m_TypeMap;
84 std::map<LogType, std::string> m_ColorMap;
88 std::string GetFormattedSource()
const;
89 std::string GetFormattedMessage(
const std::string& message);
91 void PrintObject(
const RFBase* objPtr);
98 std::ostringstream m_Message;
102 template <>
RFLog& RFLog::operator<< (
const RFBase* arg);
109 inline RFLog& RFLog::operator<< (std::ostream& (*_f)(std::ostream&)){
114 inline RFLog& RFLog::operator<< (std::ios& (*_f)(std::ios&)){
119 inline RFLog& RFLog::operator<< (LogType type){
126 const RFBase* Log(
const RFBase& obj);
127 const RFBase* Log(
const RFBase* ptr);
129 const RFList<RFBase>* Log(
const RFList<T>& list){
return (
const RFBaseList*)&list; }
131 const RFList<RFBase>* Log(
const RFList<T>* ptr){
return (
const RFBaseList*)ptr; }
134 #define LogEnd RFLog::EndMessage
144 virtual const char* what()
const throw(){
145 return m_Message.c_str();
149 std::string m_Message;
153 void SetLogPrint(
bool print =
true);
154 void SetLogPrint(LogType type,
bool print =
true);
155 void SetLogStream(std::ostream* ostr);
156 void SetLogColor(
bool color =
true);
157 void SetLogMaxWidth(
int NMAX);
158 std::map<RestFrames::LogType,bool> InitPrintMap();
Base class for all RestFrame package objects.