Skip to content

Commit

Permalink
use ctx to create the lru objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akayeshmantha committed Apr 30, 2020
1 parent 6d0e1c0 commit 7ff36c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apisix/plugins/syslog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ function _M.log(conf)
return
end

-- fetch api_ctx
local api_ctx = ngx.ctx.api_ctx
if not api_ctx then
core.log.error("invalid api_ctx cannot proceed with sys logger plugin")
return core.response.exit(500)
end

-- fetch it from lrucache
local logger, err = lrucache("127.0.0.1", "29999",
local logger, err = lrucache(api_ctx.conf_type .. "#" .. api_ctx.conf_id, api_ctx.conf_version,
logger_socket.new, logger_socket, {
host = conf.host,
port = conf.port,
Expand Down

0 comments on commit 7ff36c2

Please sign in to comment.