TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Log.h
Go to the documentation of this file.
1 
10 #ifndef G3D_LOG_H
11 #define G3D_LOG_H
12 
13 #include <stdio.h>
14 #include <string>
15 #include "G3D/platform.h"
16 
17 #ifndef G3D_WINDOWS
18  #include <stdarg.h>
19 #endif
20 
21 namespace G3D {
22 
37 void logPrintf(const char* fmt, ...);
38 
40 void logLazyPrintf(const char* fmt, ...);
41 
48 class Log {
49 private:
50 
54  FILE* logFile;
55 
56  std::string filename;
57 
58  static Log* commonLog;
59 
60 public:
62 
63 
71  Log(const std::string& filename = "log.txt",
72  int stripFromStackBottom = 0);
73 
74  virtual ~Log();
75 
79  FILE* getFile() const;
80 
84  void section(const std::string& s);
85 
89  // We want G3D_CHECK_PRINTF_ARGS here, but that conflicts with the
90  // overload.
91  void __cdecl printf(const char* fmt, ...) G3D_CHECK_PRINTF_METHOD_ARGS;
92 
93  void __cdecl vprintf(const char*, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS;
95  void __cdecl lazyvprintf(const char*, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS;
96 
97  static Log* common();
98 
99  static std::string getCommonLogFilename();
100 
101  void print(const std::string& s);
102 
103 
104  void println(const std::string& s);
105 };
106 
107 }
108 
109 #endif
void logLazyPrintf(const char *fmt,...)
Definition: Log.cpp:33
void __cdecl lazyvprintf(const char *, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS
Definition: Log.cpp:133
FILE * getFile() const
Definition: Log.cpp:95
Definition: AABox.h:25
STL namespace.
static std::string getCommonLogFilename()
Definition: Log.cpp:108
virtual ~Log()
Definition: Log.cpp:80
void print(const std::string &s)
Definition: Log.cpp:138
void __cdecl printf(const char *fmt,...) G3D_CHECK_PRINTF_METHOD_ARGS
Definition: Log.cpp:119
void section(const std::string &s)
Definition: Log.cpp:113
int stripFromStackBottom
Definition: Log.h:61
FILE * logFile
Definition: Log.h:54
Log(const std::string &filename="log.txt", int stripFromStackBottom=0)
Definition: Log.cpp:42
void logPrintf(const char *fmt,...)
Definition: Log.cpp:25
Definition: format.h:285
static Log * commonLog
Definition: Log.h:58
#define const
Definition: zconf.h:217
static Log * common()
Definition: Log.cpp:100
void println(const std::string &s)
Definition: Log.cpp:144
std::string filename
Definition: Log.h:56
Definition: Log.h:48
void __cdecl vprintf(const char *, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS
Definition: Log.cpp:127