1 #ifndef PYEMBEDDEDFUNCTIONS_H
2 #define PYEMBEDDEDFUNCTIONS_H
7 static int logEvent(
char* logString,
int logLevel)
12 if(!Py_IsInitialized())
14 PyObject *pName=NULL, *pModule=NULL, *pFunc=NULL;
15 PyObject *pArgs=NULL, *pValue=NULL;
17 pName = PyUnicode_FromString(
"proteus.Profiling");
18 pModule = PyImport_Import(pName);
22 pFunc = PyObject_GetAttrString(pModule,
"logEvent");
23 pArgs = PyTuple_New(2);
35 PyTuple_SetItem(pArgs, 0, PyUnicode_FromString(logString));
36 PyTuple_SetItem(pArgs, 1, PyLong_FromLong(logLevel));
38 PyObject_CallObject(pFunc,pArgs);
50 fprintf(stderr,
"Failed to load \"%s\"\n",
"proteus.Profiling");