diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-12-12 10:35:04 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-12-12 10:35:04 -0500 |
commit | 023488cde9c968df265df1bd8b2358f5c2216115 (patch) | |
tree | b4550f39a7cc32d63262a50f23a46f4d4a76b72e /src | |
parent | 993e608de4e7cea81b3ba1622142619a63b645f9 (diff) |
Change Basis.debug to use the protocol's debug function
Diffstat (limited to 'src')
-rw-r--r-- | src/c/request.c | 2 | ||||
-rw-r--r-- | src/c/urweb.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/c/request.c b/src/c/request.c index ae46326d..bcfec5e9 100644 --- a/src/c/request.c +++ b/src/c/request.c @@ -35,7 +35,7 @@ static int try_rollback(uw_context ctx, int will_retry, void *logger_data, uw_lo } uw_context uw_request_new_context(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug) { - uw_context ctx = uw_init(); + uw_context ctx = uw_init(logger_data, log_debug); int retries_left = MAX_RETRIES; uw_set_app(ctx, app); 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; } |