error logger headaches
This commit is contained in:
Binary file not shown.
BIN
build_linux64/objstore/amsmathutil25_errorlogger.o
Normal file
BIN
build_linux64/objstore/amsmathutil25_errorlogger.o
Normal file
Binary file not shown.
@ -25,6 +25,28 @@ static const int amsmathutil25_maxthreads = 50;
|
|||||||
static const int amsmathutil25_threadpsz = 5000;
|
static const int amsmathutil25_threadpsz = 5000;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Global Changeable Error Logger //
|
||||||
|
//Using accessor pattern
|
||||||
|
|
||||||
|
//pointer to function of signature void errorlogger(const char *errmsg, int errcode, void *errglobal);
|
||||||
|
extern void (*amsmathutil25_errlogger)(const char *, int, void *);
|
||||||
|
extern void* amsmathutil25_errglobal;
|
||||||
|
|
||||||
|
typedef void (*amsmathutil25_errloggerptr_t)(const char *, int, void *);
|
||||||
|
amsmathutil25_errloggerptr_t amsmathutil25_get_errlogger(); //call this to get the error logger to log errors
|
||||||
|
|
||||||
|
// //the other way to do this
|
||||||
|
// // return type "pointer to function(const char*, int, void*) returning void"
|
||||||
|
// void (*amsmathutil25_get_errlogger(void))(const char *, int, void *);
|
||||||
|
// //not exactly clear....
|
||||||
|
|
||||||
|
void amsmathutil25_set_errlogger(
|
||||||
|
void(*errloggerpointer)(const char *, int, void *),
|
||||||
|
void* errglobal
|
||||||
|
);
|
||||||
|
//End Error Logger
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Library subsections
|
//Library subsections
|
||||||
|
|||||||
30
src/amsmathutil25/util/amsmathutil25_errorlogger.cpp
Normal file
30
src/amsmathutil25/util/amsmathutil25_errorlogger.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <amsmathutil25/amsmathutil25.hpp>
|
||||||
|
|
||||||
|
namespace ams
|
||||||
|
{
|
||||||
|
|
||||||
|
void amsmathutil25_default_errlogger(
|
||||||
|
const char *msg,
|
||||||
|
int code,
|
||||||
|
void *)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"%s, %d\n",msg,code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
amsmathutil25_errloggerptr_t amsmathutil25_get_errlogger()
|
||||||
|
{
|
||||||
|
if(amsmathutil25_errlogger==NULL)
|
||||||
|
{
|
||||||
|
amsmathutil25_errlogger = amsmathutil25_default_errlogger;
|
||||||
|
}
|
||||||
|
return amsmathutil25_errlogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
void amsmathutil25_set_errlogger(void(*errloggerpointer)(const char *, int, void *),void *errglobal)
|
||||||
|
{
|
||||||
|
amsmathutil25_errglobal = errglobal;
|
||||||
|
amsmathutil25_errlogger = errloggerpointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user