Tianchi  v0.0.2 build 20130701
C++ library for Qt with VC & mingW
tclog.h
1 // **************************************************************************
2 // Tianchi C++ library for Qt (open source)
3 // 天池共享源码库
4 // 版权所有 (C) 天池共享源码库开发组
5 // 授权协议:请阅读天池共享源码库附带的授权协议
6 // **************************************************************************
7 // 文档说明:简单的 Log 输出类
8 // ==========================================================================
9 // 开发日志:
10 // 日期 人员 说明
11 // --------------------------------------------------------------------------
12 // 2013.04.10 圣域天子 建立
13 //
14 // ==========================================================================
16 // ==========================================================================
17 #ifndef TIANCHI_TCLOG_H
18 #define TIANCHI_TCLOG_H
19 
20 #include <tianchi/tcglobal.h>
21 
22 #include <QString>
23 
27 class TIANCHI_API TcLog
28 {
29 public:
42  void setAppFile(const QString& AppFile);
43 
51  void setLogFile(const QString& LogFile);
52 
57  void write(const QString& S,
58  const QString& SourceName = QString(),
59  int SourceLine = 0);
60 
65  inline void debug(const QString& S,
66  const QString& SourceName = QString(),
67  int SourceLine = 0)
68  {
69  #ifdef _DEBUG
70  write(S, SourceName, SourceLine);
71  #else
72  Q_UNUSED(S);
73  Q_UNUSED(SourceName);
74  Q_UNUSED(SourceLine);
75  #endif
76  }
77 
78 private:
79  QString m_FileName;
80 };
81 
83 //#define Log_Step Log.write("<<STEP>>", __FILE__, __LINE__);
84 
86 //#ifdef _DEBUG
87 // #define Debug_Log(s) Log.write(s, __FILE__, __LINE__);
88 //#else
89 // #define Debug_Log(s)
90 //#endif
91 
92 
93 #endif // TIANCHI_LOGTINY_H