From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id B764B6EC58; Wed, 26 May 2021 14:04:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B764B6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622027087; bh=FbhCT1K6A3oHkbGf6GGFL6meq6JWS6YDXYTJr0yYvY0=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=vJmS6xRExFor1gD0YYZLh8GSe+l3tDNsgTK2FnzbGLrtnZACc/kznN7du1F4OIfx/ foc6WcEnRknGx4JnA98Ny6cSseRhlYdGY/abFIn/+Ipa4A7JMHf6VtNM7KV5J3+PB7 KDlrcq+LMKEwSjN/GMGVR6P7IrNRDDEPDkzQMwlo= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [94.100.177.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3483A6EC58 for ; Wed, 26 May 2021 14:04:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3483A6EC58 Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1llrLB-0004ZT-Dt; Wed, 26 May 2021 14:04:45 +0300 To: Cyrill Gorcunov , tml Cc: Alexander Turenko References: <20210507111305.564935-1-gorcunov@gmail.com> Message-ID: <3833b8db-04e8-a676-c3c2-8dd6deba8ff5@tarantool.org> Date: Wed, 26 May 2021 14:04:44 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210507111305.564935-1-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F4D89F53055293B7D3D5E71D6EBA968B6047C881F6B697D5182A05F538085040235C1F20BFEF4BF8B31AA2B7DD254021A577E8BFA7E5052212CD745760EC035B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76DA79C5AFF329FDBEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D7C7E03580C3DB018638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B2729CEF4B39E09A5E2F54AF1E85FD86117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7B96B19DC40933214AAC223A686B1DECD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE31DAA61796BF5227B2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637870CFFD37CCFDD3AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831CEF249C29F4B3EC87E6ED54993E2D80B X-C1DE0DAB: 0D63561A33F958A5BEFF532AFF55F01C0CE383BED844377D580F7AEF949FEC54D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75E3127721F5A72C97410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341C998A3771F041534358399C3447FC8D86F2ED1F16973BA1CDF00A935D04848101E054BA1ADD849B1D7E09C32AA3244C0D77DFA1848FF16FA860F12951E63128BBA718C7E6A9E042FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojiWl9RlzdedmxPzJQ3rNemw== X-Mailru-Sender: 583F1D7ACE8F49BDB7108D03F232B783CE7E49520DB884C2B31AA2B7DD2540214AF810104A35EE5E32C2A64043BFB05F66FEC6BF5C9C28D9D2F9AC31ED4B18F0B80F102789B70DF27402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] lua/log: accept symbolic logging levels X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 07.05.2021 14:13, Cyrill Gorcunov via Tarantool-patches пишет: > Currently `log` module accepts only numeric values of > logging levels. I turn `box.cfg` interface supports > symbolic names (such as 'fatat', 'crit' and etc). > > Thus we should support the same in `log` module. > > Closes #5882 > > Reported-by: Alexander Turenko > Signed-off-by: Cyrill Gorcunov > --- > issue https://github.com/tarantool/tarantool/issues/5882 > branch gorcunov/gh-5882-logger-strings > > changelogs/unreleased/gh-5882-log-levels.md | 13 +++++++++++++ > src/lua/log.lua | 6 ++++++ > 2 files changed, 19 insertions(+) > create mode 100644 changelogs/unreleased/gh-5882-log-levels.md > > diff --git a/changelogs/unreleased/gh-5882-log-levels.md b/changelogs/unreleased/gh-5882-log-levels.md > new file mode 100644 > index 000000000..08f9595be > --- /dev/null > +++ b/changelogs/unreleased/gh-5882-log-levels.md > @@ -0,0 +1,13 @@ > +## feature/lua/log > + > + * Implemented support of symbolic log levels representation > + in `log` module (gh-5882). Now it is possible to specify > + levels the same way as in `box.cfg{}` call. For example > + instead of > + ``` Lua > + require('log').cfg{level = 6} > + ``` > + One can use > + ``` Lua > + require('log').cfg{level = 'verbose'} > + ``` > diff --git a/src/lua/log.lua b/src/lua/log.lua > index 62ea61f2d..788560722 100644 > --- a/src/lua/log.lua > +++ b/src/lua/log.lua > @@ -499,6 +499,12 @@ local function load_cfg(self, cfg) > local m = "log.cfg: \'%s\' %s" > error(m:format('level', msg)) > end > + -- Convert level to a numeric value since > + -- low level api operates with numbers only. > + if type(cfg.level) == 'string' then > + assert(log_level_keys[cfg.level] ~= nil) > + cfg.level = log_level_keys[cfg.level] > + end > end > > if cfg.nonblock ~= nil then Hi! Thanks for the patch! LGTM. -- Serge Petrenko