Work on basic logging framework.

This commit is contained in:
David Williams
2009-04-06 21:16:40 +00:00
parent 1b76395856
commit 97b162ee20
6 changed files with 70 additions and 13 deletions

View File

@ -5,6 +5,33 @@
#include <string>
POLYVOXCORE_API extern void (*logImpl)(std::string);
//Note: The functions in this file are not for the user to call - they are
//intended for internal use only. The only exception is that you may set the
//logHandler pointer to point at your own handling funtion for printing, etc.
namespace PolyVox
{
enum LogSeverity
{
LS_DEBUG,
LS_INFO,
LS_WARN,
LS_ERROR
};
POLYVOXCORE_API extern void (*logHandler)(std::string, int severity);
}
//Debug severity messages are only used if we are a debug build
#ifdef _DEBUG
#define POLYVOX_LOG_DEBUG(message) if(logHandler){logHandler(message, LS_DEBUG);}
#else
#define POLYVOX_LOG_DEBUG(message)
#endif
//Other severity levels work in both debug and release
#define POLYVOX_LOG_INFO(message) if(logHandler){logHandler(message, LS_INFO);}
#define POLYVOX_LOG_WARN(message) if(logHandler){logHandler(message, LS_WARN);}
#define POLYVOX_LOG_ERROR(message) if(logHandler){logHandler(message, LS_ERROR);}
#endif

View File

@ -38,7 +38,6 @@ namespace PolyVox
Volume<VoxelType>::Volume(uint16_t uSideLength, uint16_t uBlockSideLength)
:m_pBlocks(0)
{
logImpl("In volume constructor");
//Debug mode validation
assert(isPowerOf2(uSideLength));
assert(isPowerOf2(uBlockSideLength));

View File

@ -1,3 +1,6 @@
#include "Log.h"
void (*logImpl)(std::string) = 0;
namespace PolyVox
{
void (*logHandler)(std::string, int severity) = 0;
}