Be consistent : either we use log() everywhere or we don't ... But imho just logger.info() is fine

This commit is contained in:
Alexandre Aubin 2019-09-24 17:33:19 +02:00
parent 7cb61f1619
commit 474b922089

View file

@ -12,10 +12,6 @@ local conf = config.get_config()
local logger = require("log") local logger = require("log")
logger.outfile = "/var/log/nginx/ssowat.log" logger.outfile = "/var/log/nginx/ssowat.log"
function log(...)
logger.info(...)
end
-- Read a FS stored file -- Read a FS stored file
function read_file(file) function read_file(file)
local f = io.open(file, "rb") local f = io.open(file, "rb")
@ -164,7 +160,7 @@ function set_auth_cookie(user, domain)
"SSOwAuthHash="..hash..cookie_str, "SSOwAuthHash="..hash..cookie_str,
"SSOwAuthExpire="..expire..cookie_str "SSOwAuthExpire="..expire..cookie_str
} }
log("Hash "..hash.." generated for "..user.."@"..ngx.var.remote_addr) logger.info("Hash "..hash.." generated for "..user.."@"..ngx.var.remote_addr)
end end
@ -228,7 +224,7 @@ function is_logged_in()
"|"..expireTime.. "|"..expireTime..
"|"..session_key) "|"..session_key)
if hash ~= authHash then if hash ~= authHash then
log("Hash "..authHash.." rejected for "..user.."@"..ngx.var.remote_addr) logger.info("Hash "..authHash.." rejected for "..user.."@"..ngx.var.remote_addr)
end end
return hash == authHash return hash == authHash
end end