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
00029 #ifndef header_logger
00030 #define header_logger
00031
00032 #include "string_format.h"
00033 #include "string_help.h"
00034 #include "mutex.h"
00035
00036 class CL_Logger
00037 {
00039 public:
00040 CL_Logger();
00041
00042 ~CL_Logger();
00043
00045 public:
00046 static CL_Logger *instance;
00047
00048 static CL_Mutex mutex;
00049
00051 public:
00052 void enable();
00053
00054 void disable();
00055
00056 virtual void log(const CL_StringA &type, const CL_String &text)=0;
00057
00059 private:
00060 };
00061
00063
00064 void cl_log_event(const CL_StringA &type, const CL_StringW &text);
00065
00066 void cl_log_event(const CL_StringA &type, const CL_StringA &text);
00067
00068 template <class Arg1>
00069 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1)
00070 { CL_StringFormat f(format); f.set_arg(1, arg1); cl_log_event(type, f.get_result()); }
00071
00072 template <class Arg1, class Arg2>
00073 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2)
00074 { CL_StringFormat f(format); f.set_arg(1, arg1); f.set_arg(2, arg2); cl_log_event(type, f.get_result()); }
00075
00076 template <class Arg1, class Arg2, class Arg3>
00077 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2, Arg3 arg3)
00078 { 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()); }
00079
00080 template <class Arg1, class Arg2, class Arg3, class Arg4>
00081 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
00082 { 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()); }
00083
00084 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
00085 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
00086 { 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(arg5); cl_log_event(type, f.get_result()); }
00087
00088 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
00089 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
00090 { 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(arg5); f.set_arg(arg6); cl_log_event(type, f.get_result()); }
00091
00092 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
00093 void cl_log_event(const CL_StringA &type, const CL_StringW &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
00094 { 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(arg5); f.set_arg(arg6); f.set_arg(arg7); cl_log_event(type, f.get_result()); }
00095
00096
00097 template <class Arg1>
00098 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1)
00099 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); cl_log_event(type, f.get_result()); }
00100
00101 template <class Arg1, class Arg2>
00102 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2)
00103 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); f.set_arg(2, arg2); cl_log_event(type, f.get_result()); }
00104
00105 template <class Arg1, class Arg2, class Arg3>
00106 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2, Arg3 arg3)
00107 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); cl_log_event(type, f.get_result()); }
00108
00109 template <class Arg1, class Arg2, class Arg3, class Arg4>
00110 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
00111 { CL_StringFormat f(CL_StringHelp::local8_to_text(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()); }
00112
00113 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
00114 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
00115 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(arg5); cl_log_event(type, f.get_result()); }
00116
00117 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
00118 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
00119 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(arg5); f.set_arg(arg6); cl_log_event(type, f.get_result()); }
00120
00121 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
00122 void cl_log_event(const CL_StringA &type, const CL_StringA &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
00123 { CL_StringFormat f(CL_StringHelp::local8_to_text(format)); f.set_arg(1, arg1); f.set_arg(2, arg2); f.set_arg(3, arg3); f.set_arg(4, arg4); f.set_arg(arg5); f.set_arg(arg6); f.set_arg(arg7); cl_log_event(type, f.get_result()); }
00124
00125 #endif