Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CLog.h
Go to the documentation of this file.
1 // Copyright (C) 2009-2013 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef CDEBUG_H
22 #define CDEBUG_H
23 
24 #include "CCoreDLL.h"
25 
26 #include <fstream>
27 
28 namespace OpenSkyNet {
29  namespace Core {
30 #ifdef CORE_LOG
31  CORE_DLL extern std::ofstream g_log;
32 #endif
33  inline void beginLog() {
34 #ifdef CORE_LOG
35  g_log.open("OpenSkyNetCoreLog.txt");
36 #endif
37  }
38 
39  inline void log(const char* msg_, bool addNewline_=true) {
40 #ifdef CORE_LOG
41  g_log << msg_;
42  if (addNewline_) g_log << '\n';
43  g_log.flush();
44 #else
45  UNUSED(msg_);
46  UNUSED(addNewline_);
47 #endif
48  }
49 
50  inline void endLog() {
51 #ifdef CORE_LOG
52  g_log.close();
53 #endif
54  }
55  }
56 }
57 
58 #ifdef CORE_LOG
59  #define PRINTF_LOG(...) \
60  for (;;) { \
61  char msg[MAX_STRING_SIZE]; \
62  sprintf(msg, __VA_ARGS__); \
63  OpenSkyNet::Core::log(msg); \
64  break; \
65  }
66 #else
67  #define PRINTF_LOG(...)
68 #endif
69 
70 #endif //CDEBUG_H
#define UNUSED(var)
Definition: UTypes.h:35
void endLog()
Definition: CLog.h:50
void log(const char *msg_, bool addNewline_=true)
Definition: CLog.h:39
#define CORE_DLL
Definition: CCoreDLL.h:57
void beginLog()
Definition: CLog.h:33