[GitHub] [incubator-apisix] moonming merged pull request #1081: test: style, formatted by reindex.

2020-01-27 Thread GitBox
moonming merged pull request #1081: test: style, formatted by reindex.
URL: https://github.com/apache/incubator-apisix/pull/1081
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-apisix] branch master updated: test: style, formatted by reindex. (#1081)

2020-01-27 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 7a5bd66  test: style, formatted by reindex. (#1081)
7a5bd66 is described below

commit 7a5bd663ca83e9d85a6a3e498aa9fca1bfbbda01
Author: YuanSheng Wang 
AuthorDate: Tue Jan 28 12:13:03 2020 +0800

test: style, formatted by reindex. (#1081)
---
 t/plugin/fault-injection.t | 1 -
 t/plugin/udp-logger.t  | 5 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/plugin/fault-injection.t b/t/plugin/fault-injection.t
index 14e3770..1038d14 100644
--- a/t/plugin/fault-injection.t
+++ b/t/plugin/fault-injection.t
@@ -523,4 +523,3 @@ GET /hello HTTP/1.1
 Fault Injection!
 --- no_error_log
 [error]
-
diff --git a/t/plugin/udp-logger.t b/t/plugin/udp-logger.t
index 3ad4035..e30066c 100644
--- a/t/plugin/udp-logger.t
+++ b/t/plugin/udp-logger.t
@@ -44,6 +44,7 @@ done
 [error]
 
 
+
 === TEST 2: missing host
 --- config
 location /t {
@@ -66,6 +67,7 @@ done
 [error]
 
 
+
 === TEST 3: wrong type of string
 --- config
 location /t {
@@ -88,6 +90,7 @@ done
 [error]
 
 
+
 === TEST 4: add plugin
 --- config
 location /t {
@@ -147,6 +150,7 @@ passed
 [error]
 
 
+
 === TEST 5: access
 --- request
 GET /opentracing
@@ -157,6 +161,7 @@ opentracing
 --- wait: 0.2
 
 
+
 === TEST 6: error log
 --- config
 location /t {



[GitHub] [incubator-apisix] moonming opened a new issue #1094: add `reindex` to contribution guidelines

2020-01-27 Thread GitBox
moonming opened a new issue #1094:  add `reindex` to contribution guidelines
URL: https://github.com/apache/incubator-apisix/issues/1094
 
 
   you can add `reindex` to contribution guidelines
   
   _Originally posted by @moonming in 
https://github.com/apache/incubator-apisix/pull/1081#issuecomment-576493018_


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] moonming merged pull request #1093: chore: improve the core.log module

2020-01-27 Thread GitBox
moonming merged pull request #1093: chore: improve the core.log module
URL: https://github.com/apache/incubator-apisix/pull/1093
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-apisix] branch master updated: chore: improve the core.log module (#1093)

2020-01-27 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 6240d1a  chore: improve the core.log module (#1093)
6240d1a is described below

commit 6240d1a9b426f48811af740b84e49b8c4979b8de
Author: 罗泽轩 
AuthorDate: Tue Jan 28 12:11:47 2020 +0800

chore: improve the core.log module (#1093)

1. implement the debug method with the generic logic, so you don't need
to go into the method if you don't need it.
2. avoid computing the same result among different log levels
---
 lua/apisix/core/log.lua | 33 +
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/lua/apisix/core/log.lua b/lua/apisix/core/log.lua
index b0b60de..902b88f 100644
--- a/lua/apisix/core/log.lua
+++ b/lua/apisix/core/log.lua
@@ -32,37 +32,22 @@ local log_levels = {
 error  = ngx.ERR,
 warn   = ngx.WARN,
 notice = ngx.NOTICE,
-info   = ngx.INFO
+info   = ngx.INFO,
+debug  = ngx.DEBUG,
 }
 
 
-do
-local cur_level
-
-function _M.debug(...)
-if not cur_level then
-cur_level = ngx.config.subsystem == "http" and
-require "ngx.errlog" .get_sys_filter_level()
-end
-
-if not DEBUG and cur_level and ngx_DEBUG > cur_level then
-return
-end
-
-return ngx_log(ngx_DEBUG, ...)
-end
-
-end -- do
-
-
+local cur_level = ngx.config.subsystem == "http" and
+  require "ngx.errlog" .get_sys_filter_level()
+local do_nothing = function() end
 setmetatable(_M, {__index = function(self, cmd)
-local cur_level = ngx.config.subsystem == "http" and
-require "ngx.errlog" .get_sys_filter_level()
 local log_level = log_levels[cmd]
 
 local method
-if cur_level and log_levels[cmd] > cur_level then
-method = function() end
+if cur_level and (log_level > cur_level or
+(log_level == ngx_DEBUG and not DEBUG))
+then
+method = do_nothing
 else
 method = function(...)
 return ngx_log(log_level, ...)



[GitHub] [incubator-apisix] spacewander opened a new pull request #1093: chore: improve the core.log module

2020-01-27 Thread GitBox
spacewander opened a new pull request #1093: chore: improve the core.log module
URL: https://github.com/apache/incubator-apisix/pull/1093
 
 
   1. implement the debug method with the generic logic, so you don't need
   to go into the method if you don't need it.
   2. avoid computing the same result among different log levels


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] moonming opened a new pull request #1092: doc: add more english article.

2020-01-27 Thread GitBox
moonming opened a new pull request #1092: doc: add more english article.
URL: https://github.com/apache/incubator-apisix/pull/1092
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services