Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

logger.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2005 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
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

Generated on Sat Feb 19 22:51:16 2005 for npcore by  doxygen 1.4.1