TreeFrogFramework  1.18
tsystemglobal.h
Go to the documentation of this file.
1 #ifndef TSYSTEMGLOBAL_H
2 #define TSYSTEMGLOBAL_H
3 
4 #include <TGlobal>
5 
6 #define ENABLE_TO_TRACE_FUNCTION 0
7 
8 class TAccessLog;
9 class QSqlError;
10 
11 namespace Tf
12 {
13  T_CORE_EXPORT void setupSystemLogger(); // internal use
14  T_CORE_EXPORT void releaseSystemLogger(); // internal use
15  T_CORE_EXPORT void setupAccessLogger(); // internal use
16  T_CORE_EXPORT void releaseAccessLogger(); // internal use
17  T_CORE_EXPORT void setupQueryLogger(); // internal use
18  T_CORE_EXPORT void releaseQueryLogger(); // internal use
19  T_CORE_EXPORT void writeAccessLog(const TAccessLog &log); // write access log
20  T_CORE_EXPORT void writeQueryLog(const QString &query, bool success, const QSqlError &error);
21  T_CORE_EXPORT void traceQueryLog(const char *, ...) // SQL query log
22 #if defined(Q_CC_GNU) && !defined(__INSURE__)
23  __attribute__ ((format (printf, 1, 2)))
24 #endif
25  ;
26 
27  enum ServerOpCode {
33  };
34 }
35 
36 T_CORE_EXPORT void tSystemError(const char *, ...) // system error message
37 #if defined(Q_CC_GNU) && !defined(__INSURE__)
38  __attribute__ ((format (printf, 1, 2)))
39 #endif
40 ;
41 
42 T_CORE_EXPORT void tSystemWarn(const char *, ...) // system warn message
43 #if defined(Q_CC_GNU) && !defined(__INSURE__)
44  __attribute__ ((format (printf, 1, 2)))
45 #endif
46 ;
47 
48 T_CORE_EXPORT void tSystemInfo(const char *, ...) // system info message
49 #if defined(Q_CC_GNU) && !defined(__INSURE__)
50  __attribute__ ((format (printf, 1, 2)))
51 #endif
52 ;
53 
54 T_CORE_EXPORT void tSystemDebug(const char *, ...) // system debug message
55 #if defined(Q_CC_GNU) && !defined(__INSURE__)
56  __attribute__ ((format (printf, 1, 2)))
57 #endif
58 ;
59 
60 T_CORE_EXPORT void tSystemTrace(const char *, ...) // system trace message
61 #if defined(Q_CC_GNU) && !defined(__INSURE__)
62  __attribute__ ((format (printf, 1, 2)))
63 #endif
64 ;
65 
66 #if !defined(TF_NO_DEBUG) && ENABLE_TO_TRACE_FUNCTION && !defined(Q_OS_WIN)
67 
68 class T_CORE_EXPORT TTraceFunc
69 {
70 public:
71  TTraceFunc(const char *funcname) : functionName(funcname) { }
72  ~TTraceFunc() { tSystemTrace("<- Leave %s()", functionName); }
73 
74 private:
75  const char *functionName;
76 };
77 
78 # define T_TRACEFUNC(fmt, ...) TTraceFunc ___tracefunc(__func__); \
79  tSystemTrace("-> Enter %s() " fmt, __func__, ## __VA_ARGS__)
80 
81 #else
82 # define T_TRACEFUNC(fmt, ...)
83 #endif
84 
85 #endif // TSYSTEMGLOBAL_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
T_CORE_EXPORT void releaseSystemLogger()
Definition: tsystemglobal.cpp:63
T_CORE_EXPORT void releaseQueryLogger()
Definition: tsystemglobal.cpp:101
Definition: tsystemglobal.h:32
T_CORE_EXPORT void setupAccessLogger()
Definition: tsystemglobal.cpp:69
T_CORE_EXPORT void tSystemDebug(const char *,...)
Definition: tsystemglobal.cpp:146
T_CORE_EXPORT void tSystemWarn(const char *,...)
Definition: tsystemglobal.cpp:127
T_CORE_EXPORT void setupSystemLogger()
Definition: tsystemglobal.cpp:46
T_CORE_EXPORT void writeAccessLog(const TAccessLog &log)
Definition: tsystemglobal.cpp:38
The Tf namespace contains miscellaneous identifiers used throughout the library of TreeFrog Framework...
Definition: tdebug.h:8
ServerOpCode
Definition: tsystemglobal.h:27
T_CORE_EXPORT void setupQueryLogger()
Definition: tsystemglobal.cpp:91
T_CORE_EXPORT void tSystemError(const char *,...)
Definition: tsystemglobal.cpp:118
Definition: tsystemglobal.h:31
T_CORE_EXPORT void traceQueryLog(const char *,...)
Definition: tsystemglobal.cpp:171
T_CORE_EXPORT void tSystemTrace(const char *,...)
Definition: tsystemglobal.cpp:155
Definition: tsystemglobal.h:28
Definition: tsystemglobal.h:30
T_CORE_EXPORT void writeQueryLog(const QString &query, bool success, const QSqlError &error)
Definition: tsystemglobal.cpp:184
T_CORE_EXPORT void releaseAccessLogger()
Definition: tsystemglobal.cpp:82
T_CORE_EXPORT void tSystemInfo(const char *,...)
Definition: tsystemglobal.cpp:136
Definition: tsystemglobal.h:29