Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 0/3] lua/cfg: drop unused code and extend test
@ 2020-06-08 10:44 Cyrill Gorcunov
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods Cyrill Gorcunov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2020-06-08 10:44 UTC (permalink / raw)
  To: tml

Left from logger rework, in addition to #689. Note that to allow
accepting symbolic names in box.cfg{} we need more modifications,
so I postponed it for a while.

branch gorcunov/gh-689-logger-9-extension

Cyrill Gorcunov (3):
  lua/cfg: drop unused log methods
  lua/cfg: drop redundant variable
  test: app-tap/logger -- test symbolic loglevels

 src/box/lua/cfg.cc           | 24 ------------------------
 src/box/lua/load_cfg.lua     |  2 +-
 test/app-tap/logger.test.lua | 26 +++++++++++++++++++++++++-
 3 files changed, 26 insertions(+), 26 deletions(-)

-- 
2.26.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods
  2020-06-08 10:44 [Tarantool-patches] [PATCH 0/3] lua/cfg: drop unused code and extend test Cyrill Gorcunov
@ 2020-06-08 10:44 ` Cyrill Gorcunov
  2020-06-08 15:29   ` Oleg Babin
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable Cyrill Gorcunov
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels Cyrill Gorcunov
  2 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2020-06-08 10:44 UTC (permalink / raw)
  To: tml

The dynamic configuration of logging level and
format now goes via log module. These functions
are no longed needed.

Part-of #689

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/lua/cfg.cc | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/src/box/lua/cfg.cc b/src/box/lua/cfg.cc
index ed56b0b5c..a5b15e527 100644
--- a/src/box/lua/cfg.cc
+++ b/src/box/lua/cfg.cc
@@ -87,28 +87,6 @@ lbox_cfg_set_replication(struct lua_State *L)
 	return 0;
 }
 
-static int
-lbox_cfg_set_log_level(struct lua_State *L)
-{
-	try {
-		box_set_log_level();
-	} catch (Exception *) {
-		luaT_error(L);
-	}
-	return 0;
-}
-
-static int
-lbox_cfg_set_log_format(struct lua_State *L)
-{
-	try {
-		box_set_log_format();
-	} catch (Exception *) {
-		luaT_error(L);
-	}
-	return 0;
-}
-
 static int
 lbox_cfg_set_readahead(struct lua_State *L)
 {
@@ -374,8 +352,6 @@ box_lua_cfg_init(struct lua_State *L)
 		{"cfg_set_listen", lbox_cfg_set_listen},
 		{"cfg_set_replication", lbox_cfg_set_replication},
 		{"cfg_set_worker_pool_threads", lbox_cfg_set_worker_pool_threads},
-		{"cfg_set_log_level", lbox_cfg_set_log_level},
-		{"cfg_set_log_format", lbox_cfg_set_log_format},
 		{"cfg_set_readahead", lbox_cfg_set_readahead},
 		{"cfg_set_io_collect_interval", lbox_cfg_set_io_collect_interval},
 		{"cfg_set_too_long_threshold", lbox_cfg_set_too_long_threshold},
-- 
2.26.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable
  2020-06-08 10:44 [Tarantool-patches] [PATCH 0/3] lua/cfg: drop unused code and extend test Cyrill Gorcunov
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods Cyrill Gorcunov
@ 2020-06-08 10:44 ` Cyrill Gorcunov
  2020-06-08 15:31   ` Oleg Babin
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels Cyrill Gorcunov
  2 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2020-06-08 10:44 UTC (permalink / raw)
  To: tml

No need for variable v, we use module_cfg itself.

Part-of #689

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/lua/load_cfg.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 7a77b93f5..7dc40a47f 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -494,7 +494,7 @@ local function apply_default_cfg(cfg, default_cfg, module_cfg)
             apply_default_cfg(cfg[k], v)
         end
     end
-    for k, v in pairs(module_cfg) do
+    for k in pairs(module_cfg) do
         if cfg[k] == nil then
             cfg[k] = module_cfg[k].cfg_get(k)
         end
-- 
2.26.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels
  2020-06-08 10:44 [Tarantool-patches] [PATCH 0/3] lua/cfg: drop unused code and extend test Cyrill Gorcunov
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods Cyrill Gorcunov
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable Cyrill Gorcunov
@ 2020-06-08 10:44 ` Cyrill Gorcunov
  2020-06-08 15:31   ` Oleg Babin
  2020-06-09  8:26   ` Kirill Yukhin
  2 siblings, 2 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2020-06-08 10:44 UTC (permalink / raw)
  To: tml

Part-of #689

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 test/app-tap/logger.test.lua | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
index c2f0ab5c0..ae4a3b99a 100755
--- a/test/app-tap/logger.test.lua
+++ b/test/app-tap/logger.test.lua
@@ -1,7 +1,7 @@
 #!/usr/bin/env tarantool
 
 local test = require('tap').test('log')
-test:plan(54)
+test:plan(62)
 
 -- gh-3946: Assertion failure when using log_format() before box.cfg()
 local log = require('log')
@@ -70,6 +70,30 @@ test:ok(box.cfg.log == filename, "filename match")
 test:ok(box.cfg.log_level == 6, "loglevel match")
 verify_keys("box.cfg")
 
+-- Test symbolic names for loglevels
+log.cfg({level='fatal'})
+test:ok(log.cfg.level == 0 and box.cfg.log_level == 0, 'both got fatal')
+log.cfg({level='syserror'})
+test:ok(log.cfg.level == 1 and box.cfg.log_level == 1, 'both got syserror')
+log.cfg({level='error'})
+test:ok(log.cfg.level == 2 and box.cfg.log_level == 2, 'both got error')
+log.cfg({level='crit'})
+test:ok(log.cfg.level == 3 and box.cfg.log_level == 3, 'both got crit')
+log.cfg({level='warn'})
+test:ok(log.cfg.level == 4 and box.cfg.log_level == 4, 'both got warn')
+log.cfg({level='info'})
+test:ok(log.cfg.level == 5 and box.cfg.log_level == 5, 'both got info')
+log.cfg({level='verbose'})
+test:ok(log.cfg.level == 6 and box.cfg.log_level == 6, 'both got verbose')
+log.cfg({level='debug'})
+test:ok(log.cfg.level == 7 and box.cfg.log_level == 7, 'both got debug')
+
+box.cfg{
+    log = filename,
+    log_level = 6,
+    memtx_memory = 107374182,
+}
+
 -- Now try to change a static field.
 _, err = pcall(box.cfg, {log_level = 5, log = "2.txt"})
 test:ok(tostring(err):find("can\'t be set dynamically") ~= nil)
-- 
2.26.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods Cyrill Gorcunov
@ 2020-06-08 15:29   ` Oleg Babin
  2020-06-08 15:33     ` Cyrill Gorcunov
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Babin @ 2020-06-08 15:29 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

Hi! Thanks for your patch. See 1 comment below.

On 08/06/2020 13:44, Cyrill Gorcunov wrote:
> The dynamic configuration of logging level and
> format now goes via log module. These functions
> are no longed needed.
> 
> Part-of #689
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>   src/box/lua/cfg.cc | 24 ------------------------
>   1 file changed, 24 deletions(-)
> 
> diff --git a/src/box/lua/cfg.cc b/src/box/lua/cfg.cc
> index ed56b0b5c..a5b15e527 100644
> --- a/src/box/lua/cfg.cc
> +++ b/src/box/lua/cfg.cc
> @@ -87,28 +87,6 @@ lbox_cfg_set_replication(struct lua_State *L)
>   	return 0;
>   }
>   
> -static int
> -lbox_cfg_set_log_level(struct lua_State *L)
> -{
> -	try {
> -		box_set_log_level();
> -	} catch (Exception *) {
> -		luaT_error(L);
> -	}
> -	return 0;
> -}
> -
> -static int
> -lbox_cfg_set_log_format(struct lua_State *L)
> -{
> -	try {
> -		box_set_log_format();
> -	} catch (Exception *) {
> -		luaT_error(L);
> -	}
> -	return 0;
> -}
> -

I assume that "box_set_log_level" and "box_set_log_format" should be 
removed as well.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable Cyrill Gorcunov
@ 2020-06-08 15:31   ` Oleg Babin
  0 siblings, 0 replies; 10+ messages in thread
From: Oleg Babin @ 2020-06-08 15:31 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

Thanks for your patch. LGTM.

On 08/06/2020 13:44, Cyrill Gorcunov wrote:
> No need for variable v, we use module_cfg itself.
> 
> Part-of #689
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>   src/box/lua/load_cfg.lua | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
> index 7a77b93f5..7dc40a47f 100644
> --- a/src/box/lua/load_cfg.lua
> +++ b/src/box/lua/load_cfg.lua
> @@ -494,7 +494,7 @@ local function apply_default_cfg(cfg, default_cfg, module_cfg)
>               apply_default_cfg(cfg[k], v)
>           end
>       end
> -    for k, v in pairs(module_cfg) do
> +    for k in pairs(module_cfg) do
>           if cfg[k] == nil then
>               cfg[k] = module_cfg[k].cfg_get(k)
>           end
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels Cyrill Gorcunov
@ 2020-06-08 15:31   ` Oleg Babin
  2020-06-09  8:26   ` Kirill Yukhin
  1 sibling, 0 replies; 10+ messages in thread
From: Oleg Babin @ 2020-06-08 15:31 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

Thanks for your patch. LGTM.

On 08/06/2020 13:44, Cyrill Gorcunov wrote:
> Part-of #689
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>   test/app-tap/logger.test.lua | 26 +++++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
> index c2f0ab5c0..ae4a3b99a 100755
> --- a/test/app-tap/logger.test.lua
> +++ b/test/app-tap/logger.test.lua
> @@ -1,7 +1,7 @@
>   #!/usr/bin/env tarantool
>   
>   local test = require('tap').test('log')
> -test:plan(54)
> +test:plan(62)
>   
>   -- gh-3946: Assertion failure when using log_format() before box.cfg()
>   local log = require('log')
> @@ -70,6 +70,30 @@ test:ok(box.cfg.log == filename, "filename match")
>   test:ok(box.cfg.log_level == 6, "loglevel match")
>   verify_keys("box.cfg")
>   
> +-- Test symbolic names for loglevels
> +log.cfg({level='fatal'})
> +test:ok(log.cfg.level == 0 and box.cfg.log_level == 0, 'both got fatal')
> +log.cfg({level='syserror'})
> +test:ok(log.cfg.level == 1 and box.cfg.log_level == 1, 'both got syserror')
> +log.cfg({level='error'})
> +test:ok(log.cfg.level == 2 and box.cfg.log_level == 2, 'both got error')
> +log.cfg({level='crit'})
> +test:ok(log.cfg.level == 3 and box.cfg.log_level == 3, 'both got crit')
> +log.cfg({level='warn'})
> +test:ok(log.cfg.level == 4 and box.cfg.log_level == 4, 'both got warn')
> +log.cfg({level='info'})
> +test:ok(log.cfg.level == 5 and box.cfg.log_level == 5, 'both got info')
> +log.cfg({level='verbose'})
> +test:ok(log.cfg.level == 6 and box.cfg.log_level == 6, 'both got verbose')
> +log.cfg({level='debug'})
> +test:ok(log.cfg.level == 7 and box.cfg.log_level == 7, 'both got debug')
> +
> +box.cfg{
> +    log = filename,
> +    log_level = 6,
> +    memtx_memory = 107374182,
> +}
> +
>   -- Now try to change a static field.
>   _, err = pcall(box.cfg, {log_level = 5, log = "2.txt"})
>   test:ok(tostring(err):find("can\'t be set dynamically") ~= nil)
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods
  2020-06-08 15:29   ` Oleg Babin
@ 2020-06-08 15:33     ` Cyrill Gorcunov
  2020-06-08 15:37       ` Oleg Babin
  0 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2020-06-08 15:33 UTC (permalink / raw)
  To: Oleg Babin; +Cc: tml

On Mon, Jun 08, 2020 at 06:29:25PM +0300, Oleg Babin wrote:
> Hi! Thanks for your patch. See 1 comment below.
...
> 
> I assume that "box_set_log_level" and "box_set_log_format" should be removed
> as well.

Nope, they are called when we modify dynamic settings via box.cfg{}.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods
  2020-06-08 15:33     ` Cyrill Gorcunov
@ 2020-06-08 15:37       ` Oleg Babin
  0 siblings, 0 replies; 10+ messages in thread
From: Oleg Babin @ 2020-06-08 15:37 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

On 08/06/2020 18:33, Cyrill Gorcunov wrote:
> On Mon, Jun 08, 2020 at 06:29:25PM +0300, Oleg Babin wrote:
>> Hi! Thanks for your patch. See 1 comment below.
> ...
>>
>> I assume that "box_set_log_level" and "box_set_log_format" should be removed
>> as well.
> 
> Nope, they are called when we modify dynamic settings via box.cfg{}.
> 

Thanks for explanation. LGTM.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels
  2020-06-08 10:44 ` [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels Cyrill Gorcunov
  2020-06-08 15:31   ` Oleg Babin
@ 2020-06-09  8:26   ` Kirill Yukhin
  1 sibling, 0 replies; 10+ messages in thread
From: Kirill Yukhin @ 2020-06-09  8:26 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

Hello,

On 08 июн 13:44, Cyrill Gorcunov wrote:
> Part-of #689
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

I've checked your patchset into master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-09  8:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 10:44 [Tarantool-patches] [PATCH 0/3] lua/cfg: drop unused code and extend test Cyrill Gorcunov
2020-06-08 10:44 ` [Tarantool-patches] [PATCH 1/3] lua/cfg: drop unused log methods Cyrill Gorcunov
2020-06-08 15:29   ` Oleg Babin
2020-06-08 15:33     ` Cyrill Gorcunov
2020-06-08 15:37       ` Oleg Babin
2020-06-08 10:44 ` [Tarantool-patches] [PATCH 2/3] lua/cfg: drop redundant variable Cyrill Gorcunov
2020-06-08 15:31   ` Oleg Babin
2020-06-08 10:44 ` [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels Cyrill Gorcunov
2020-06-08 15:31   ` Oleg Babin
2020-06-09  8:26   ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox