Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ngx_http_lua_kong_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ngx_http_lua_kong_ffi_set_dynamic_log_level(int log_level, int timeout)
** we will not change the current log level,
** and return an error.
*/
if (log_level > NGX_LOG_DEBUG || log_level < NGX_LOG_STDERR) {
if (log_level > NGX_LOG_DEBUG_LAST || log_level < NGX_LOG_STDERR) {
return NGX_ERROR;
}

Expand Down
29 changes: 29 additions & 0 deletions t/008-log.t
Original file line number Diff line number Diff line change
Expand Up @@ -938,3 +938,32 @@ GET /test
]
--- no_log eval
"you can't see me init_worker"



=== TEST 25: set_log_level and get_log_level support extended Nginx debug levels
--- http_config
lua_package_path "../lua-resty-core/lib/?.lua;lualib/?.lua;;";
--- config
location = /test {
content_by_lua_block {
local log = require("resty.kong.log")
local DEBUG_MAIL = 0x200

assert(pcall(log.set_log_level, DEBUG_MAIL, 2))
assert(log.get_log_level(ngx.WARN) == DEBUG_MAIL)

ngx.sleep(3)
assert(log.get_log_level(ngx.WARN) == ngx.WARN)

ngx.say("ok")
}
}
--- timeout: 5s
--- request
GET /test
--- response_body
ok
--- no_error_log
[error]
[crit]