Browse Source

trace utility in logger

master
Eduardo Bart 12 years ago
parent
commit
914a76e54a
  1. 4
      src/graphics.cpp
  2. 13
      src/logger.h
  3. 2
      src/x11platform.cpp

4
src/graphics.cpp

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

13
src/logger.h

@ -13,10 +13,13 @@ enum ELogLevel { @@ -13,10 +13,13 @@ enum ELogLevel {
void _log(int level, const char *trace, const char *format, ...);
#define fatal(...) _log(LFATAL, NULL, ## __VA_ARGS__)
#define error(...) _log(LERROR, NULL, ## __VA_ARGS__)
#define warning(...) _log(LWARNING, NULL, ## __VA_ARGS__)
#define debug(...) _log(LDEBUG, NULL, ## __VA_ARGS__)
#define notice(...) _log(LNOTICE, NULL, ## __VA_ARGS__)
#define fatal(...) _log(LFATAL, NULL, __VA_ARGS__)
#define error(...) _log(LERROR, NULL, __VA_ARGS__)
#define warning(...) _log(LWARNING, NULL, __VA_ARGS__)
#define debug(...) _log(LDEBUG, NULL, __VA_ARGS__)
#define notice(...) _log(LNOTICE, NULL, __VA_ARGS__)
#define trace() _log(LDEBUG, __PRETTY_FUNCTION__, "")
#define tdebug(...) _log(LDEBUG, __PRETTY_FUNCTION__, __VA_ARGS__)
#endif

2
src/x11platform.cpp

@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
#include "logger.h"
#include <cstring>
#include <ctime>
#include <string>
#include <algorithm>
#include <map>
#include <time.h>
#include <sys/time.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>

Loading…
Cancel
Save