00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_core.h"
00035 #include "string_format.h"
00036 #include "string_help.h"
00037 #include "../System/mutex.h"
00038
00042 class CL_API_CORE CL_Logger
00043 {
00046
00047 public:
00049 CL_Logger();
00050
00051 virtual ~CL_Logger();
00052
00056
00057 public:
00059 static std::vector<CL_Logger*> instances;
00060
00062 static CL_Mutex mutex;
00063
00067
00068 public:
00070 void enable();
00071
00073 void disable();
00074
00076 virtual void log(const CL_StringRef &type, const CL_StringRef &text);
00077
00081
00082 private:
00084 };
00085
00089 CL_API_CORE void cl_log_event(const CL_StringRef &type, const CL_StringRef &text);
00090
00091 template <class Arg1>
00092 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1)
00093 { CL_StringFormat f(format); f.set_arg(1, arg1); cl_log_event(type, f.get_result()); }
00094
00095 template <class Arg1, class Arg2>
00096 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2)
00097 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); cl_log_event(type, f.get_result()); }
00098
00099 template <class Arg1, class Arg2, class Arg3>
00100 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2, Arg3 arg3)
00101 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); cl_log_event(type, f.get_result()); }
00102
00103 template <class Arg1, class Arg2, class Arg3, class Arg4>
00104 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
00105 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); cl_log_event(type, f.get_result()); }
00106
00107 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
00108 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
00109 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(5, arg5); cl_log_event(type, f.get_result()); }
00110
00111 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
00112 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
00113 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(5, arg5); f.set_arg(6, arg6); cl_log_event(type, f.get_result()); }
00114
00115 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
00116 void cl_log_event(const CL_StringRef &type, const CL_StringRef &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
00117 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(5, arg5); f.set_arg(6, arg6); f.set_arg(7, arg7); cl_log_event(type, f.get_result()); }
00118