optimize(core): avoid useless comparisons in log.lua (#767)

This commit is contained in:
jackstraw 2019-10-31 08:12:13 +08:00 committed by YuanSheng Wang
parent b49b03d863
commit b3b09240a5

View File

@ -19,12 +19,12 @@ for name, log_level in pairs({stderr = ngx.STDERR,
warn = ngx.WARN, warn = ngx.WARN,
notice = ngx.NOTICE, notice = ngx.NOTICE,
info = ngx.INFO, }) do info = ngx.INFO, }) do
_M[name] = function(...) if cur_level and log_level > cur_level then
if cur_level and log_level > cur_level then _M[name] = function() end
return else
_M[name] = function(...)
return ngx_log(log_level, ...)
end end
return ngx_log(log_level, ...)
end end
end end