From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (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 99093469710 for ; Thu, 28 May 2020 13:36:58 +0300 (MSK) From: Oleg Babin References: <20200528100738.221911-1-gorcunov@gmail.com> <20200528100738.221911-2-gorcunov@gmail.com> Message-ID: Date: Thu, 28 May 2020 13:36:56 +0300 MIME-Version: 1.0 In-Reply-To: <20200528100738.221911-2-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 1/8] core/say: do not reconfig early set up 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. LGTM. On 28/05/2020 13:07, Cyrill Gorcunov wrote: > We gonna support logger configuration on its own > without requirement to call `box.cfg{}`. Thus lets > say_logger_init() to skip processing if we already > did. > > Note it is preparatory for next patches. Currently > the init called once. > > Part-of #689 > > Signed-off-by: Cyrill Gorcunov > --- > src/lib/core/say.c | 13 +++++++++++++ > src/lib/core/say.h | 4 ++++ > 2 files changed, 17 insertions(+) > > diff --git a/src/lib/core/say.c b/src/lib/core/say.c > index e22089aac..d8f59fb9b 100644 > --- a/src/lib/core/say.c > +++ b/src/lib/core/say.c > @@ -684,10 +684,23 @@ log_create(struct log *log, const char *init_str, int nonblock) > return 0; > } > > +bool > +say_logger_initialized(void) > +{ > + return log_default == &log_std; > +} > + > void > say_logger_init(const char *init_str, int level, int nonblock, > const char *format, int background) > { > + /* > + * The logger may be early configured > + * by hands without configuing the whole box. > + */ > + if (say_logger_initialized()) > + return; > + > if (log_create(&log_std, init_str, nonblock) < 0) > goto fail; > > diff --git a/src/lib/core/say.h b/src/lib/core/say.h > index c50d7bbf4..857145465 100644 > --- a/src/lib/core/say.h > +++ b/src/lib/core/say.h > @@ -274,6 +274,10 @@ say_logger_init(const char *init_str, > const char *log_format, > int background); > > +/** Test if logger is initialized. */ > +bool > +say_logger_initialized(void); > + > /** Free default logger */ > void > say_logger_free(); >