Skip to content

Commit 99a5ba2

Browse files
thibaultchaagentzh
authored andcommitted
feature: added a pure C API function ngx_http_lua_ffi_raw_log for ngx.errlog module's rawlog() function in the lua-resty-core library.
Signed-off-by: Yichun Zhang (agentzh) <[email protected]>
1 parent 51b7d64 commit 99a5ba2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/ngx_http_lua_log.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,29 @@ ngx_http_lua_ffi_errlog_get_sys_filter_level(ngx_http_request_t *r)
428428
return log_level;
429429
}
430430

431+
432+
int
433+
ngx_http_lua_ffi_raw_log(ngx_http_request_t *r, int level, u_char *s,
434+
size_t s_len)
435+
{
436+
ngx_log_t *log;
437+
438+
if (level > NGX_LOG_DEBUG || level < NGX_LOG_STDERR) {
439+
return NGX_ERROR;
440+
}
441+
442+
if (r && r->connection && r->connection->log) {
443+
log = r->connection->log;
444+
445+
} else {
446+
log = ngx_cycle->log;
447+
}
448+
449+
ngx_log_error((unsigned) level, log, 0, "%*s", s_len, s);
450+
451+
return NGX_OK;
452+
}
453+
431454
#endif
432455

433456
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

0 commit comments

Comments
 (0)