From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 E8D72469710 for ; Thu, 28 May 2020 13:40:26 +0300 (MSK) From: Oleg Babin References: <20200528100738.221911-1-gorcunov@gmail.com> <20200528100738.221911-5-gorcunov@gmail.com> Message-ID: Date: Thu, 28 May 2020 13:40:25 +0300 MIME-Version: 1.0 In-Reply-To: <20200528100738.221911-5-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v4 4/8] lua/log: do not allow to set json for boot logger List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Hi! Thanks for your patch see one comment below. On 28/05/2020 13:07, Cyrill Gorcunov wrote: > For some reason we've missed that say_set_log_format > doesn't support json format not only for syslog but > for boottime logging as well. > > Part-of #689 > > Signed-off-by: Cyrill Gorcunov > --- > src/lua/log.lua | 7 +++++-- > test/app-tap/logger.test.lua | 1 - > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/lua/log.lua b/src/lua/log.lua > index d1d712cab..2491501f7 100644 > --- a/src/lua/log.lua > +++ b/src/lua/log.lua > @@ -160,8 +160,11 @@ local function log_format(name) > end > > if fmt_str2num[name] == ffi.C.SF_JSON then > - if ffi.C.log_type() == ffi.C.SAY_LOGGER_SYSLOG then > - error("log_format: 'json' can't be used with syslog logger") > + if ffi.C.log_type() == ffi.C.SAY_LOGGER_SYSLOG or > + ffi.C.log_type() == ffi.C.SAY_LOGGER_BOOT then > + local m = "log_format: %s can't be used with " .. > + "syslog or boot-time logger" > + error(m:format(fmt_num2str[ffi.C.SF_JSON])) > end > ffi.C.say_set_log_format(ffi.C.SF_JSON) > else > diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua > index 492d5ea0b..7bfa06e80 100755 > --- a/test/app-tap/logger.test.lua > +++ b/test/app-tap/logger.test.lua > @@ -5,7 +5,6 @@ test:plan(24) > > -- gh-3946: Assertion failure when using log_format() before box.cfg() > local log = require('log') > -log.log_format('json') I think you can change it to "pcall(log.log_format, 'json')" and check that it returns an error. Not simply drop a test case. > log.log_format('plain') > > -- >