From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (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 29B96469710 for ; Thu, 28 May 2020 14:59:31 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id w15so16357110lfe.11 for ; Thu, 28 May 2020 04:59:31 -0700 (PDT) Date: Thu, 28 May 2020 14:59:27 +0300 From: Cyrill Gorcunov Message-ID: <20200528115927.GF215590@grain> References: <20200528100738.221911-1-gorcunov@gmail.com> <20200528100738.221911-5-gorcunov@gmail.com> <8353e47e-7e24-e60e-e2e9-bce5a5ea0757@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8353e47e-7e24-e60e-e2e9-bce5a5ea0757@tarantool.org> 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: lvasiliev Cc: tml On Thu, May 28, 2020 at 02:49:04PM +0300, lvasiliev wrote: > > 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])) > Why do you use the format if the message is always the same? To eliminate opencoded 'json' constant.