Browse Source

trace utility in logger

Eduardo Bart 10 years ago
parent
commit
914a76e54a
3 changed files with 13 additions and 6 deletions
  1. 4
    0
      src/graphics.cpp
  2. 8
    5
      src/logger.h
  3. 1
    1
      src/x11platform.cpp

+ 4
- 0
src/graphics.cpp View File

@@ -1,4 +1,5 @@
1 1
 #include "graphics.h"
2
+#include "logger.h"
2 3
 
3 4
 #include <GL/gl.h>
4 5
 #include <GL/glu.h>
@@ -22,6 +23,9 @@ void Graphics::init()
22 23
     glEnable(GL_ALPHA_TEST); // enable alpha
23 24
     glAlphaFunc(GL_GREATER, 0.0f); // default alpha mode
24 25
     glDisable(GL_DEPTH_TEST); // we are rendering 2D only, we don't need it
26
+
27
+    notice("GPU %s", (const char*)glGetString(GL_RENDERER));
28
+    notice("OpenGL %s", (const char*)glGetString(GL_VERSION));
25 29
 }
26 30
 
27 31
 void Graphics::terminate()

+ 8
- 5
src/logger.h View File

@@ -13,10 +13,13 @@ enum ELogLevel {
13 13
 
14 14
 void _log(int level, const char *trace, const char *format, ...);
15 15
 
16
-#define fatal(...) _log(LFATAL, NULL, ## __VA_ARGS__)
17
-#define error(...) _log(LERROR, NULL, ## __VA_ARGS__)
18
-#define warning(...) _log(LWARNING, NULL, ## __VA_ARGS__)
19
-#define debug(...) _log(LDEBUG, NULL, ## __VA_ARGS__)
20
-#define notice(...) _log(LNOTICE, NULL, ## __VA_ARGS__)
16
+#define fatal(...) _log(LFATAL, NULL, __VA_ARGS__)
17
+#define error(...) _log(LERROR, NULL, __VA_ARGS__)
18
+#define warning(...) _log(LWARNING, NULL, __VA_ARGS__)
19
+#define debug(...) _log(LDEBUG, NULL, __VA_ARGS__)
20
+#define notice(...) _log(LNOTICE, NULL, __VA_ARGS__)
21
+
22
+#define trace() _log(LDEBUG, __PRETTY_FUNCTION__, "")
23
+#define tdebug(...) _log(LDEBUG, __PRETTY_FUNCTION__, __VA_ARGS__)
21 24
 
22 25
 #endif

+ 1
- 1
src/x11platform.cpp View File

@@ -4,12 +4,12 @@
4 4
 #include "logger.h"
5 5
 
6 6
 #include <cstring>
7
-#include <ctime>
8 7
 
9 8
 #include <string>
10 9
 #include <algorithm>
11 10
 #include <map>
12 11
 
12
+#include <time.h>
13 13
 #include <sys/time.h>
14 14
 #include <X11/Xlib.h>
15 15
 #include <X11/Xatom.h>

Loading…
Cancel
Save