summaryrefslogtreecommitdiff
path: root/src/c/urweb.c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-12 10:35:04 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-12 10:35:04 -0500
commit023488cde9c968df265df1bd8b2358f5c2216115 (patch)
treeb4550f39a7cc32d63262a50f23a46f4d4a76b72e /src/c/urweb.c
parent993e608de4e7cea81b3ba1622142619a63b645f9 (diff)
Change Basis.debug to use the protocol's debug function
Diffstat (limited to 'src/c/urweb.c')
-rw-r--r--src/c/urweb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index b4a15bce..47c6dadf 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -442,6 +442,9 @@ struct uw_context {
void *client_data;
+ void *logger_data;
+ uw_logger log_debug;
+
char error_message[ERROR_BUF_LEN];
};
@@ -450,7 +453,7 @@ size_t uw_page_max = SIZE_MAX;
size_t uw_heap_max = SIZE_MAX;
size_t uw_script_max = SIZE_MAX;
-uw_context uw_init() {
+uw_context uw_init(void *logger_data, uw_logger log_debug) {
uw_context ctx = malloc(sizeof(struct uw_context));
ctx->app = NULL;
@@ -501,6 +504,9 @@ uw_context uw_init() {
ctx->client_data = uw_init_client_data();
+ ctx->logger_data = logger_data;
+ ctx->log_debug = log_debug;
+
return ctx;
}
@@ -3441,8 +3447,10 @@ void uw_check_deadline(uw_context ctx) {
size_t uw_database_max = SIZE_MAX;
uw_Basis_unit uw_Basis_debug(uw_context ctx, uw_Basis_string s) {
- fprintf(stderr, "%s\n", s);
-
+ if (ctx->log_debug)
+ ctx->log_debug(ctx->logger_data, "%s\n", s);
+ else
+ fprintf(stderr, "%s\n", s);
return uw_unit_v;
}