From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <lvasiliev@tarantool.org>
Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38])
 (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 5C430469710
 for <tarantool-patches@dev.tarantool.org>;
 Fri, 29 May 2020 12:16:10 +0300 (MSK)
References: <20200528100738.221911-1-gorcunov@gmail.com>
 <20200528100738.221911-8-gorcunov@gmail.com>
 <19d91eba-a988-0ee8-6c1b-1b83dca9fce8@tarantool.org>
 <51ab9c83-4392-b5bd-49ac-652b1892afa0@tarantool.org>
From: Leonid Vasiliev <lvasiliev@tarantool.org>
Message-ID: <68d0aeab-2db7-b552-ec0d-4bc64de792e1@tarantool.org>
Date: Fri, 29 May 2020 12:16:08 +0300
MIME-Version: 1.0
In-Reply-To: <51ab9c83-4392-b5bd-49ac-652b1892afa0@tarantool.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Subject: Re: [Tarantool-patches] [PATCH v4 7/8] lua/log: allow to configure
 logging without a box
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Oleg Babin <olegrok@tarantool.org>, Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org>

Hi!
Maybe we need to apply something like the "observer" pattern.
When changes in "log" occur, it alerts subscribers.

On 29.05.2020 11:53, Oleg Babin wrote:
> Hi! It's ok I think. box.cfg table stores user-defined values.
> But it's a good point. There is an example of similar behaviour[1]:
> 
> ```
> tarantool> box.cfg{listen = 0}
> ---
> ...
> 
> tarantool> box.cfg.listen
> ---
> - '0'
> ...
> 
> tarantool> box.info.listen
> ---
> - '[::]:64991'
> ...
> ```
> 
> box.cfg.listen is "0" because you acually specify it by hands. 
> box.info.listen is real value of property.
> 
> My point in such case don't try to support consistency between box.cfg 
> and log.cfg. But:
>    - log.cfg should always store an actual value of parameters
>    - box.info (maybe, but not box.cfg) should also do it.
> 
> I hope it's appropriate stay it as is but file an issue to fix such it 
> in future. It won't breaking change for existing installations (that 
> doesn't use log.cfg{})
> 
> [1] https://github.com/tarantool/tarantool/issues/4620
> 
> On 29/05/2020 11:41, Leonid Vasiliev wrote:
>  > Hi! Thank you for the patch.
>  > See some comments below.
> 
> ...
> 
>  >
>  > tarantool> log.cfg{log_level = 2}
>  > ---
>  > ...
>  >
>  > tarantool> box.cfg.log_level
>  > ---
>  > - 3
>  > ...
>  >
>  > tarantool> log.cfg.log_level
>  > ---
>  > - 2
>  > ...