From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 95A1C4696C2 for ; Mon, 25 May 2020 15:18:28 +0300 (MSK) Received: by mail-lj1-f173.google.com with SMTP id w10so20588081ljo.0 for ; Mon, 25 May 2020 05:18:28 -0700 (PDT) From: Cyrill Gorcunov Date: Mon, 25 May 2020 15:17:11 +0300 Message-Id: <20200525121715.21216-7-gorcunov@gmail.com> In-Reply-To: <20200525121715.21216-1-gorcunov@gmail.com> References: <20200525121715.21216-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 06/10] 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: tml Cc: Alexander Turenko 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 3fceb1d0e..c6e03ad78 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') log.log_format('plain') -- -- 2.26.2