summaryrefslogtreecommitdiff
path: root/src/portal
diff options
context:
space:
mode:
Diffstat (limited to 'src/portal')
-rw-r--r--src/portal/cpy/lib.pxd8
-rw-r--r--src/portal/cpy/portal.pyx8
-rw-r--r--src/portal/cpy/setup.py2
-rw-r--r--src/portal/src/search.c16
4 files changed, 17 insertions, 17 deletions
diff --git a/src/portal/cpy/lib.pxd b/src/portal/cpy/lib.pxd
index 5749141..6a5b69c 100644
--- a/src/portal/cpy/lib.pxd
+++ b/src/portal/cpy/lib.pxd
@@ -7,7 +7,7 @@ cdef extern from "<al/lib.h>":
void al_bzero(void *s, size_t n)
cdef extern from "<al/log.h>":
- s32 al_log_info(const char *ns, const char *, ...)
- s32 al_log_warn(const char *ns, const char *, ...)
- s32 al_log_error(const char *ns, const char *, ...)
- s32 al_log_debug(const char *ns, const char *, ...)
+ s32 log_info(const char *, ...)
+ s32 log_warn(const char *, ...)
+ s32 log_error(const char *, ...)
+ s32 log_debug(const char *, ...)
diff --git a/src/portal/cpy/portal.pyx b/src/portal/cpy/portal.pyx
index 22d2ef9..b9b6e8d 100644
--- a/src/portal/cpy/portal.pyx
+++ b/src/portal/cpy/portal.pyx
@@ -7,16 +7,16 @@ import sys
sys.path.append('./py')
cdef int log_info(char *message) except -1:
- return lib.al_log_info("portal", "%s", message)
+ return lib.log_info("%s", message)
cdef int log_warn(char *message) except -1:
- return lib.al_log_warn("portal", "%s", message)
+ return lib.log_warn("%s", message)
cdef int log_error(char *message) except -1:
- return lib.al_log_error("portal", "%s", message)
+ return lib.log_error("%s", message)
cdef int log_debug(char *message) except -1:
- return lib.al_log_debug("portal", "%s", message)
+ return lib.log_debug("%s", message)
def encode_str(str):
return str.encode('UTF-8')
diff --git a/src/portal/cpy/setup.py b/src/portal/cpy/setup.py
index 7267bff..d14068f 100644
--- a/src/portal/cpy/setup.py
+++ b/src/portal/cpy/setup.py
@@ -3,4 +3,4 @@ from Cython.Build import cythonize
from Cython.Compiler import Options
Options.embed = True
alabaster_inc = "../../../subprojects/libalabaster/include"
-cythonize([Extension("portal", ["./portal.pyx"], include_dirs=[alabaster_inc], extra_link_args=[])], language_level=3)
+cythonize([Extension("portal", ["./portal.pyx"], include_dirs=[alabaster_inc], extra_link_args=[], define_macros=[("AL_LOG_SECTION", "portal")])], language_level=3)
diff --git a/src/portal/src/search.c b/src/portal/src/search.c
index c66e7a8..81d1e72 100644
--- a/src/portal/src/search.c
+++ b/src/portal/src/search.c
@@ -20,12 +20,12 @@ bool camu_python_init(void)
PyStatus status = Py_PreInitialize(&pre_config);
if (PyStatus_Exception(status)) {
- error("Preinitialization failed.");
+ log_error("Preinitialization failed.");
return false;
}
if (PyImport_AppendInittab("portal", PyInit_portal) == -1) {
- error("Could not extend in-built modules table.");
+ log_error("Could not extend in-built modules table.");
return false;
}
@@ -34,7 +34,7 @@ bool camu_python_init(void)
PyObject *module = PyImport_ImportModule("portal");
if (!module) {
PyErr_Print();
- error("Could not import module.");
+ log_error("Could not import module.");
goto err;
}
@@ -73,7 +73,7 @@ static nn_thread_result NNWT_THREADCALL queue_thread(void *userdata)
if (!have_python) {
// Defer python init.
if (!(have_python = camu_python_init())) {
- error("Failed to initialize python.");
+ log_error("Failed to initialize python.");
break;
}
}
@@ -96,9 +96,9 @@ static nn_thread_result NNWT_THREADCALL queue_thread(void *userdata)
al_array_init(search->pages);
search->bridge = bridge;
al_array_push(bridge->searches, search);
- info("New search %x (%.*s).", result.id, al_str_x(&cmd->query));
+ log_info("New search %x (%.*s).", result.id, al_str_x(&cmd->query));
} else {
- info("Failed to create search (%.*s).", al_str_x(&cmd->query));
+ log_info("Failed to create search (%.*s).", al_str_x(&cmd->query));
}
al_str_free(&cmd->module);
al_str_free(&cmd->query);
@@ -112,7 +112,7 @@ static nn_thread_result NNWT_THREADCALL queue_thread(void *userdata)
al_array_foreach_ptr(search->pages, j, page) {
if (page->num == cmd->num) break;
}
- info("Loading page %i (%.*s).", cmd->num, al_str_x(&search->query));
+ log_info("Loading page %i (%.*s).", cmd->num, al_str_x(&search->query));
if (portal_bridge_get_page(search, search->id, cmd->num) == -1) {
break;
}
@@ -124,7 +124,7 @@ static nn_thread_result NNWT_THREADCALL queue_thread(void *userdata)
}
}
} else {
- info("Requested search doesn't exist (id: %d).", search->id);
+ log_info("Requested search doesn't exist (id: %d).", search->id);
result.id = -1;
}
break;