libagg/draw/debug.h

60 lines
1.6 KiB
C++

/**
*******************************************************************************
* @file draw/debug.h
* @brief draw : log wrapper (Sources)
* @author Edouard DUPIN
* @date 21/08/2012
* @par Project
* Ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __DRAW_DEBUG_H__
#define __DRAW_DEBUG_H__
#include <etk/log.h>
namespace draw {
int32_t getLogId();
};
#define DRAW_BASE(info,data) TK_LOG_BASE(draw::getLogId(),info,data)
#define DRAW_CRITICAL(data) DRAW_BASE(1, data)
#define DRAW_ERROR(data) DRAW_BASE(2, data)
#define DRAW_WARNING(data) DRAW_BASE(3, data)
#ifdef DEBUG
#define DRAW_INFO(data) DRAW_BASE(4, data)
#define DRAW_DEBUG(data) DRAW_BASE(5, data)
#define DRAW_VERBOSE(data) DRAW_BASE(6, data)
#define DRAW_TODO(data) DRAW_BASE(4, "TODO : " << data)
#else
#define DRAW_INFO(data) do { } while(false)
#define DRAW_DEBUG(data) do { } while(false)
#define DRAW_VERBOSE(data) do { } while(false)
#define DRAW_TODO(data) do { } while(false)
#endif
#define DRAW_ASSERT(cond,data) \
do { \
if (!(cond)) { \
DRAW_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)
#endif