File gpi_logging.cpp

GPI logging

Write a log message using cocotb SimLog class

GILState before calling: Unknown

GILState after calling: Unknown

Makes one call to PyGILState_Ensure and one call to PyGILState_Release

If the Python logging mechanism is not initialised, dumps to stderr.

void gpi_log_v(const char *name, enum gpi_log_levels level, const char *pathname, const char *funcname, long lineno, const char *msg, va_list argp)
void gpi_log(const char *name, enum gpi_log_levels level, const char *pathname, const char *funcname, long lineno, const char *msg, ...)

Defines

LOG_SIZE 512

Functions

void set_log_handler(void *handler)
void clear_log_handler(void)
void set_log_filter(void *filter)
void clear_log_filter(void)
void set_log_level(enum gpi_log_levels new_level)
const char *log_level(long level)
void gpi_log_native_v(const char *name, enum gpi_log_levels level, const char *pathname, const char *funcname, long lineno, const char *msg, va_list argp)

Log without going through the python hook.

This is needed for both when the hook isn’t connected yet, and for when a python exception occurs while trying to use the hook.

void gpi_log_native(const char *name, enum gpi_log_levels level, const char *pathname, const char *funcname, long lineno, const char *msg, ...)

Variables

PyObject *pLogHandler = NULL
PyObject *pLogFilter = NULL
enum gpi_log_levels local_level = GPIInfo
struct _log_level_table log_level_table[] = {{10, "DEBUG"}, {20, "INFO"}, {30, "WARNING"}, {40, "ERROR"}, {50, "CRITICAL"}, {0, NULL}}
char log_buff[LOG_SIZE]
struct _log_level_table

Public Members

long level
const char *levelname