trace utility in logger

This commit is contained in:
Eduardo Bart 2010-11-19 10:37:02 -02:00
parent 77d1ebc8c5
commit 914a76e54a
3 changed files with 13 additions and 6 deletions

View File

@ -1,4 +1,5 @@
#include "graphics.h" #include "graphics.h"
#include "logger.h"
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
@ -22,6 +23,9 @@ void Graphics::init()
glEnable(GL_ALPHA_TEST); // enable alpha glEnable(GL_ALPHA_TEST); // enable alpha
glAlphaFunc(GL_GREATER, 0.0f); // default alpha mode glAlphaFunc(GL_GREATER, 0.0f); // default alpha mode
glDisable(GL_DEPTH_TEST); // we are rendering 2D only, we don't need it 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() void Graphics::terminate()

View File

@ -13,10 +13,13 @@ enum ELogLevel {
void _log(int level, const char *trace, const char *format, ...); void _log(int level, const char *trace, const char *format, ...);
#define fatal(...) _log(LFATAL, NULL, ## __VA_ARGS__) #define fatal(...) _log(LFATAL, NULL, __VA_ARGS__)
#define error(...) _log(LERROR, NULL, ## __VA_ARGS__) #define error(...) _log(LERROR, NULL, __VA_ARGS__)
#define warning(...) _log(LWARNING, NULL, ## __VA_ARGS__) #define warning(...) _log(LWARNING, NULL, __VA_ARGS__)
#define debug(...) _log(LDEBUG, NULL, ## __VA_ARGS__) #define debug(...) _log(LDEBUG, NULL, __VA_ARGS__)
#define notice(...) _log(LNOTICE, 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 #endif

View File

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